[java]Dynamically changing submenus
[java]Dynamically changing submenus
- Subject: [java]Dynamically changing submenus
- From: Julien Chiron <email@hidden>
- Date: Thu, 19 Sep 2002 16:42:27 +0200
Hi,
I didn't find anything about this in archives :
I have some nib files in a document based application.
Let say that two nib files, each one contains a menu, and a window.
This menu has to be set as submenu of a MainMenu's menuItem, depending
on which window is the key one.
In both controllers I implemented the two delegate methods:
windowDidBecomeKey, which call setMyMenu in my Application Controller.
and windowDidResignKey which call desactivateMyMenu in my Application
Controller.
These functions look like :
################################
//parentMenuItem is in the main menu
public void setMyMenu(NSMenu theMenu)
{
if (theMenu.supermenu() == null)
{
parentMenuItem.setSubmenu(theMenu);
theMenu.update();
}
parentMenuItem.setEnabled(true);
}
public void desactivateMyMenu()
{
parentMenuItem.setEnabled(false);
}
###############################
The problem is that it works only for the first window loaded!
The menu works very well for this one, but it's always disabled for the
other windows.
Everyting seems to work fine in my code, but not on the screen.
The submenu is changed each time the key window changes, but the items
are always disabled but for the first window.
The target and action of the menuItems are never broken.
I tried to enable the menu automatically implementing the
validateMenuItem which return true.
The log said they where enabled and disabled when they should, but it
wasn't the same thing on the screen.
Same thing enabling manually.
What the hell is that !!!
Did anybody had similar problem (and solved it)?
Thanks
Julien Chiron
Laboratoire de Valorisation de la Chimie Fine
Service 552
Faculti des Sciences de Saint Jirtme
13397 Marseille CEDEX 20
FRANCE
Tel: 33 (0)4 91 28 81 92
Fax : 33 (0)4 91 28 83 23
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.