Re: Snapping Window Locations
Re: Snapping Window Locations
- Subject: Re: Snapping Window Locations
- From: Matt Neuburg <email@hidden>
- Date: Wed, 19 Jun 2002 05:20:30 -0700
On Mon, 17 Jun 2002 19:09:02 -0500, Charles Jolley <email@hidden> said:
>
I am trying to create some floating palettes using NSPanel's that should
>
snap to each other and to the edge of the screen, etc. The problem is
>
there does not seem to be anyway in NSWindow/NSPanel to intercept the
>
move events as the window is being moved. I tried subclassing the
>
various setFrame: methods but none of them appear to be called when the
>
window is being moved around. I have also tried using the mouseDragged:
>
method, but I can't figure out how to accurately calculate the new
>
window position. (NSWindow does not receive a mouseDown: or mouseUp:
>
message when the window is moved.)
Start with the example in the Cocoa documentation
(HandlingMouseEvents.html). Override MouseDown to record the position of
the mouse relative to the window and perform your own eventloop using
nextEventMatchingMask, as in the example. If the user drags, move the
window. If the user releases the mouse, snap the window into position. m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.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.