Re: coordinate transformation
Re: coordinate transformation
- Subject: Re: coordinate transformation
- From: p3consulting <email@hidden>
- Date: Tue, 28 Dec 2004 09:44:19 +0100
Correct, the original code I posted is used to pop-up a window under the cursor...
Here to pop-up below a button, from the action associated with it:
- (id)sender
{
NSRect senderFrame = [sender bounds] ;
senderFrame = [sender convertRect:senderFrame toView:nil] ; // nil <==> [[sender window] contentView]
NSRect windowFrame = [[sender window] frame] ;
senderFrame.origin.x += windowFrame.origin.x ;
senderFrame.origin.y += windowFrame.origin.y - senderFrame.size.height ;
senderFrame.size.width = // what you want it to be ;
senderFrame.size.height = // what you want it to be ;
// now senderFrame is the frame of the window you should create
// unless you want a title bar of which you have to take into account the height
// to move down the frame a little bit more
Pascal Pochet
email@hidden
----------------------------------
PGP
KeyID: 0x208C5DBF
Fingerprint: 9BFB 245C 5BFE 7F1D 64B7 C473 ABB3 4E83 208C 5DBF
Le déc. 27, 2004, à 22:15, Frank Fenn a écrit :
On Dec 27, 2004, at 7:40 AM, p3consulting wrote:
NSPoint currentLocation = [self convertBaseToScreen:[theEvent locationInWindow]]
I've tried this approach but then I always have the screen coordinate of the mouse click within
the button frame - but I need the actual button frame position to open the window exactly under
the left/bottom point without covering the button itself.
Sincerely,
Frank Fenn
--
Bright Light Software - http://www.brightlightsoftware.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden