 |
 |
Drawers...
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2000
Status:
Offline
|
|
OK 2 questions..
1) How do I set the maximum height for a drawer? It seems to comply with the maximum width set in setMaxContentSize: (I believe that's it) but totally ignores the height. I don't want it to be as tall as the window. How can this be done?
2) How do you get a drawer to appear at startup ala Mail? Opening the drawer in awakeFromNib does not work. And when I press my Toggle Drawer button.. the first time it doesn't work.. as if it was "open" programmatically.. but not visually. Then the second time, it opens. Which would only happen if it were closed. So what I am thinking is that drawers don't like being open offscreen. When you open Mail, the drawer actually opens after you see the window... What notification should I catch? becameMain and becameKey are not what I want since they are also called when I click on them from a different app. I want something that's called when the window is first visible. Then I am hoping opening the drawer will work.
Thanks 
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Nov 2001
Status:
Offline
|
|
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by Synotic:
<strong>OK 2 questions..
1) How do I set the maximum height for a drawer? It seems to comply with the maximum width set in setMaxContentSize: (I believe that's it) but totally ignores the height. I don't want it to be as tall as the window. How can this be done?
2) How do you get a drawer to appear at startup ala Mail? Opening the drawer in awakeFromNib does not work. And when I press my Toggle Drawer button.. the first time it doesn't work.. as if it was "open" programmatically.. but not visually. Then the second time, it opens. Which would only happen if it were closed. So what I am thinking is that drawers don't like being open offscreen. When you open Mail, the drawer actually opens after you see the window... What notification should I catch? becameMain and becameKey are not what I want since they are also called when I click on them from a different app. I want something that's called when the window is first visible. Then I am hoping opening the drawer will work.
Thanks  </strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">1) This one's tricky: here's how to do it (straight from cocoadev.com):
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">
</font> - <font size="1" face="Geneva, Verdana, Arial, sans-serif"> don't try to set the drawer's minContentSize; </font></li>
- <font size="1" face="Geneva, Verdana, Arial, sans-serif"> in the parent window's delegate, implement windowDidResize: and in that method set the drawer's trailing offset based on the parent window's frame size (take the height and subtract some fixed constant); </font></li>
- <font size="1" face="Geneva, Verdana, Arial, sans-serif"> in the parent window's delegate, implement windowWillResize:toSize: to constrain the parent window's height so that there is sufficient room for the drawer.
</font></li>
<font size="1" face="Geneva, Verdana, Arial, sans-serif"></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">2) I couldn't find any notifications or delegate methods you wanted, so, as a rather nasty hack you could have an ivar declared as: </font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">BOOL firstTimeOfDisplay;</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">. Then in your awakeFromNib method, do:
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">firstTimeOfDisplay = YES;</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">, and then implement this in your window's delegate:
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">- (void)windowDidBecomeKey  NSNotification *)aNotification
{
if (firstTimeOfDisplay)
{
[myDrawer open];
firstTimeOfDisplay = NO;
}
}</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2000
Status:
Offline
|
|
For number one... won't this only do it when I stop moving for a second or let go? Is there no way to create a real one that acts more normal?
I'd try myself but I may have to downgrade my dev tools unless someone can figure out my <a href="http://forums.macnn.com/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=46;t=007426" target="_blank">problem</a> :/
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Nov 2001
Status:
Offline
|
|
There is no "easy" way to create a fixed-width drawer. I believe the windowDidResize: is sent *during* a live-resize. To quote from the NSWindow docs:
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">
windowDidResize:
Sent by the default notification center immediately after an NSWindow has been resized
</font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">
|
|
|
| |
|
|
|
 |
|
 |
|
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status:
Offline
|
|
the last time i tried number 1, everything was full of bugs. you couldn't make windows smaller ay more -- sounds stupid, i know, but that's the way it was.
for number 2, simply use [whoever performSelector:@selector(selector  withObject:nil afterDelay:0.5] and either call a method that's able to open the drawer, or directly call the drawer's toggle:
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|