Re: Restraining window movement + gridding
Re: Restraining window movement + gridding
- Subject: Re: Restraining window movement + gridding
- From: Henry McGilton <email@hidden>
- Date: Thu, 16 Oct 2003 16:15:47 -0700
On Thursday, October 16, 2003, at 03:08 PM, mmalcolm crawford wrote:
On Oct 16, 2003, at 2:24 PM, Rolf wrote:
16.10.2003 21:48:51, skrev mmalcolm crawford <email@hidden>:
On Oct 16, 2003, at 11:47 AM, Rolf Peder Klemetsen wrote:
I removed the [[NSNotificationCenter defaultCenter] addObserver.
However the -windowWillMove is still not being called.
-windowWillResize is not
being called either.
Are the method signatures exactly right -- including arguments?
Yes, I have copy-and-paste directly from the documentation - twice
before - and now I
have tried it again !
Interestingly -windowWillUpdate IS being called. So delegates are
bing
called but not the two I need :-(
Is the delegate set correctly? If it's set in IB, are you resetting
it programatically elsewhere?
Since I can't get -windowWillMove to work I now use -windowDidMove
instead. But it is
no perfect solution - the user can drag the window briefly outside of
visible screen area
before it is forced back in again ..
windowWillMove et al. are "notification" methods, not delegate
methods. Delegate methods allow you to alter the behaviour of the
object of which you are a delegate; notifications simply inform you
that something is happening. There isn't a delegate method to do
exactly what -- now that I read your original post, and what should
have been obvious from the subject, sorry -- you want to do...
Here is a message I posted to the list back in April, and nobody
ever responded to it. I do not know if this will be useful for
Rolf's described problem, but it might be relevant.
This comes under the general rubric of 'The
Journal of Failed Experiments' . . .
I was programmatically creating windows and their associated views,
and I created a window whose style mask is thus:
styleMask: (NSBorderlessWindowMask | NSTexturedBackgroundWindowMask)
Now, for a variety of reasons, I need to be aware of when the
window is being moved. As far as I can tell, with a Borderless
Window, the window's delegate never sees the windowWillMove
notification; the window's delegate receives only windowDidMove
notification(s) (plural, as in many of them).
The documentation is unclear, in the sense that one must read
between the lines and try to guess what the intention was and what
the behaviour might be.
I decided that the ideal behaviour would be if the delegate received
a windowWillMove notification at the time that the window was
about to start moving, and would receive a windowDidMove
notification when the window stopped moving.
Unfortunately, the above ideal appears not to be the case.
So I then created the window with the style mask thus:
styleMask: (NSTitledWindowMask | NSTexturedBackgroundWindowMask)
Now, the window's delegate *does* see the windowWillMove notification
only if the mouse goes down in the title bar. And as in the case
above, there are an indeterminate number of windowDidMove
delegate calls (but with a determinate lower limit of one).
So, one hopes that one or more of the wizards at Apple are
reading this and can shed some light on the behaviour.
Best Wishes,
........ Henry
===============================+============================
Henry McGilton, Boulevardier | Trilithon Software
Objective-C/Java Composer | Seroia Research
-------------------------------+----------------------------
mailto:email@hidden |
http://www.trilithon.com
|
===============================+============================
_______________________________________________
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.