Re: How to Make a Very Thin Window? - Solved
Re: How to Make a Very Thin Window? - Solved
- Subject: Re: How to Make a Very Thin Window? - Solved
- From: Steve Cronin <email@hidden>
- Date: Wed, 5 Dec 2007 08:46:01 -0600
Folks;
For the record I thought I would submit what I did to get this to work.
There was a menu item, in MainMenu, which would invoke both the
windowController's -initWithNib and -showWindow.
The nib referenced here was a second nib - NOT - 'MainMenu'.
The windowController was set as this second nib's fileOwner and the
windowController's -window was an outlet hooked up in IB in this 2nd
nib.
The window was fully created in IB in the 2nd nib.
The way I solved the problem was to first create the window
programmatically and then utilize the windowController's -
initWithWindow method.
I have to implement all the dragging and resizing code for the window
because the NSBorderlessWindow mask does not create any UI widgets.
(NOTE the NSWindow class' method -setShowResizeIndicator is
apparently just ignored)
In order to do this the window has to be created before the
windowController's -initWithWindow.
So neither the window itself, nor the windowController, are involved
in the 2 nib mentioned above.
Now that I am creating both window and windowController in the menu
action in MainMenu I have to migrate all the UI widgets into a view
in MainMenu.
In fact, it appears, the 2nd Nib is no longer useful as such. So I
must migrate all of its objects to MainMenu. (Arrgh!)
This new view is set as the contentView for the programatiically
created window.
If someone sees a flaw or a better way to do this - chime in!
Hopefully this will be useful to someone else.
Steve
//create the window
[self setMyWindow:[MyWindow alloc] initWithContentRect:someWindowRect
styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered
defer:NO]];
[[self myWindow] setFrame:someWindowRect display:YES];
[[self myWindow] setLevel:NSNormalWindowLevel];
[[self myWindow] setOpaque:YES];
[[self myWindow] setHasShadow:YES];
[[self myWindow] setMinSize:NSMakeSize(MIN_WIN_WIDTH,
MIN_WIN_HEIGHT)]; //static floats
[[self myWindow] setMinSize:NSMakeSize(MAX_WIN_WIDTH,
MAX_WIN_HEIGHT)];; //static floats
[[self myWindow] setContentView:myWindowView]; //(an NSView
IBOutlet in appController)
//create the windowController
[self setMyWindowController:[[MyWindowController alloc]
initWithWindow:[self myWindow]]];
//hook them up
[[self myWindow] setDelegate:[self myWindowController]];
//rock-n-roll
[[self myWindowController] showWindow:self];
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden