Re: Restraining window movement + gridding
Re: Restraining window movement + gridding
- Subject: Re: Restraining window movement + gridding
- From: Rolf Peder Klemetsen <email@hidden>
- Date: Thu, 16 Oct 2003 20:47:28 +0200
- Organization: Ontrax Custom Software Development AS
Hi Alstair,
Thanks.
I removed the [[NSNotificationCenter defaultCenter] addObserver. However the -
windowWillMove is still not being called. -windowWillResize is not being called either.
Interestingly -windowWillUpdate IS being called. So delegates are bing called but not the
two I need :-(
Kind regards,
Rolf
16.10.2003 12:24:46, skrev "Alastair J.Houghton" <email@hidden>:
>
On Thursday, October 16, 2003, at 12:40 am, Rolf wrote:
>
>
> Hi,
>
>
>
> I need to restrain window movement in my app as follows:
>
> - Gridding: It must only allow to have origins that are evenly
>
> divisible by X, for example 0,4,8,12, etc.
>
> - Restrain: No sides are allowed to move outside of visible screen
>
> area.
>
>
>
> I assume a possible solution to this is using
>
> NSWindowWillMoveNotification. However the following does not work
>
> (windowWillMove is never called), and I don't understand why:
>
>
>
>
>
> [[NSNotificationCenter defaultCenter] addObserver:self
>
> selector:@selector(windowWillMove:)
>
> name:@"NSWindowWillMoveNotification" object:self];
>
>
>
>
Why do that? It's much easier just to set-up a delegate for your
>
window; the delegate is automatically registered for the
>
window-will-move notification by the NSWindow code. Plus, the way the
>
above is written, it looks as if you have subclassed NSWindow, which is
>
probably unnecessary.
>
>
Just implement -windowWillMove: and -windowWillResize:toSize: on your
>
delegate object.
>
>
Kind regards,
>
>
Alastair.
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.