Re: Restraining window movement + gridding
Re: Restraining window movement + gridding
- Subject: Re: Restraining window movement + gridding
- From: Charles Jolley <email@hidden>
- Date: Sat, 18 Oct 2003 11:20:36 -0700
I have found in my own work that the only way to do this was to
implement my own window moving code. i.e. I added mouseDown:,
mouseDragged:, and mouseUp: to my content view and in those methods I
actually moved the window myself. That seems to be the only way to
make it work consistently across different versions of OS X.
-Charles
On Oct 17, 2003, at 7:56 AM, Rolf wrote:
Hi Henry,
Thanks. Seems like you ran into the same problems! Unfortunately the
window in my app has to be borderless ..
If -windowWillMove is supposed to work like this I think it should be
documented.
/Rolf
17.10.2003 01:15:47, skrev Henry McGilton <email@hidden>:
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.
_______________________________________________
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.