| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
I'm having a problem with the NSMenu / NSMenuItem classes. I want a certain menu to be visible in the menu bar only if a certain window is visible. To that purpose, I've implemented the two delegate messages of NSWindow:
- (void)windowDidBecomeMain:(NSNotification *)aNotification
{
[mainMenu addItem:simulationMenu];
}
- (void)windowDidResignMain:(NSNotification *)aNotification
{
[mainMenu removeItem:simulationMenu];
}
The menu is added to the menu bar when the window becomes main for the first time, and is properly removed from the menu bar when the window resigns main.
Unfortunately, this works only once. After the menu has been removed once,
it does never appear in the menu bar again :-(
(I've added code to print the [mainMenu description], and the interesting thing is that it looks all right -- the simulationMenu is correctly added and removed; it simply doesn't appear on the screen!)
Can anybody help me with that? Is there something like the old DrawMenuBar that you have to call to update the menu bar?
| References: | |
| >Problem with NSMenu -addItem and -removeItem (From: Andreas Schweizer <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.