adding menu items and making them work [Java]
adding menu items and making them work [Java]
- Subject: adding menu items and making them work [Java]
- From: John Spicer <email@hidden>
- Date: Tue, 5 Oct 2004 19:13:42 -0500
I'm trying to add an item to a menu and get it to work (enabled).
This is the code:
NSMenu theMenuBar = NSApplication.sharedApplication().mainMenu ();
NSMenuItem theView = theMenuBar.itemWithTitle("View");
NSMenu theViewMenu = theView.submenu();
NSMenuItem item = new NSMenuItem("Herbert, Frank", new NSSelector("choosePatient::", new Class[] {getClass()}), "");
item.setEnabled(true);
item.setTarget(this);
theViewMenu.addItem(item);
public void choosePatient (Object sender)
{
NSApplication.beep ();
}
Everything compiles and runs OK. But the menu item will not enable. I've tried removing my validation method, etc. Am I missing something obvious? _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden