Re: Goofy NSDrawer behavior
Re: Goofy NSDrawer behavior
- Subject: Re: Goofy NSDrawer behavior
- From: Leslie Orchard <email@hidden>
- Date: Tue, 24 Jul 2001 13:27:39 -0400
On Tuesday, July 24, 2001, at 12:04 PM, Douglas Davidson wrote:
You may want to look into the NSWindow method setFrame:display:animate:
with the animate option turned on.
(...snip...)
Douglas Davidson
Wow, thanks! I must have missed the animate option in the docs... though
I haven't pawed through the headers much yet. That worked like a charm.
In case anyone's interested, after the babbling I've done on the list
about this, here's the method I came up with to make my magically
self-resizing window. There are a few things I'm still working out.. for
instance, I'd like the window to be non-resizable in it's small state, yet
resizable in its expandable state. I haven't found yet how to toggle that.
Also, I'm having some funkiness with the resizing of the messages panel
I drop into the expanded window.
But anyway, here's the code, if anyone's interested, or sees any nasty
glaring newbee mistakes:
- (IBAction)showMessages:(id)sender {
if (windowExpanded == NO) {
// Flip the flag to signify that the window has been expanded
windowExpanded = YES;
// Update the origin of the expanded window's frame to the current
window's
// origin, then account for the height increase given by the resize.
expandedWindowFrame.origin = [mainWindow frame].origin;
expandedWindowFrame.origin.y -= expandedWindowFrame.size.height -
basicWindowFrame.size.height;
// Animate the resize, and lock down the window size.
[mainWindow setFrame:expandedWindowFrame display:YES animate:YES];
[mainWindow setMinSize:expandedWindowFrame.size];
[mainWindow setMaxSize:expandedWindowFrame.size];
// Cause the messages view to appear within the window.
[mainWindowView addSubview:messagesView];
} else {
// Flip the flag to signify that the window has been shrunk
windowExpanded = NO;
// Cause the messages view to disappear from the window.
[messagesView removeFromSuperview];
// Remember the size of the expanded window if it's been resized.
//expandedWindowFrame.size = [mainWindow frame].size;
// Update the origin of the basic window's frame to the current
window's
// origin, then account for the height decrease in the resize.
basicWindowFrame.origin = [mainWindow frame].origin;
basicWindowFrame.origin.y += expandedWindowFrame.size.height -
basicWindowFrame.size.height;
// Animate the window resizing, and lock down the size.
[mainWindow setFrame:basicWindowFrame display:YES animate:YES];
[mainWindow setMinSize:basicWindowFrame.size];
[mainWindow setMaxSize:basicWindowFrame.size];
}
}
--
Leslie Michael Orchard <email@hidden>
ICQ: 492905 (home) 11082089 (work)
"...see you space cowboy..."