Re: Cancelling a window move
Re: Cancelling a window move
- Subject: Re: Cancelling a window move
- From: Brad Carter <email@hidden>
- Date: Tue, 24 Jul 2007 14:31:56 -0600
I'm not sure about preventing it moving but here's a method I used.
It takes advantage of the NSNotification windowDidMove:
It's been about 3 months since I did any programing and I'm very new
so there might be something I'm overlooking but hopefully this will
give you a good start. screenRect is a global NSRect and
MAINWINDOWHEIGHT is defined in my .h file as 550 (your window height
would be different).
- (void)windowDidMove:(NSNotification *)aNotification
{
NSLog(@"window moved notification received");
NSPoint windowPoint;
screenRect = [[NSScreen mainScreen] frame];
windowPoint.x = 0;
windowPoint.y = (screenRect.size.height - MAINWINDOWHEIGHT);
[oMainWindow setFrameOrigin:windowPoint];
}
-Brad
On Jul 24, 2007, at 1:09 PM, Tomas Zahradnicky wrote:
Dear Cocoa developers,
our app occasionally needs to prevent users to move (and/or resize)
a cocoa window with a titlebar. I've successfully solved the resize
by overriding setFrame:... methods and that seems to perfectly
work. On the other hand, I'm quite desperate with the move as
windowserver moves the window and I can only know that the window
will move via the notification.
Is there a way to interrupt the window move after being notified
with the windowWillMove notification?
All the best,
Tomas Zahradnicky
# Ing. Tomas Zahradnicky, Jr.
# Assistant Professor
# The Czech Technical University
# Dept of Computer Science, FEE-CTU Prague
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden