Re: Putting window titlebar under menu
Re: Putting window titlebar under menu
- Subject: Re: Putting window titlebar under menu
- From: email@hidden
- Date: Fri, 25 Jan 2002 11:56:05 +0100
Is there any way to force a window (a floating panel) to have its
titlebar under the menubar? I've tried using
setFrameTopLeftPoint: but if I specify a position under the
menubar, it moves the window to the right instead...
i thing your NSBorderlessWindowMask is the right solution in this case.
just you may need to call a mouseDown event so that you can move your
window for a right placement [think of clock in OS X ]:
- (void)mouseDown:(NSEvent *)theEvent
{
dragStartLocation = [theEvent locationInWindow];
}
- (void)mouseDragged:(NSEvent *)theEvent
{
if([theEvent type] == NSLeftMouseDragged)
{
NSPoint origin;
NSPoint newLocation;
origin = [[self window] frame].origin;
newLocation = [theEvent locationInWindow];
[[self window] setFrameOrigin:
NSMakePoint(origin.x + newLocation.x - dragStartLocation.x,
origin.y + newLocation.y - dragStartLocation.y)];
}
}
let dragStartLocation be in @interface declaration
NSPoint dragStartLocation;
besides, keeping the window level at the top will be more of help:
[yourWindow setLevel: NSStatusWindowLevel];
so that you can keep your window anywhere even above the menubar
amazing :)
==
chandan
(remember, the code i've pasted for you is not written by me. it's my
collection from a friend. i've tested and modified it for my purpose. it
works just as one more CoolFact :)