hierarchical menus
hierarchical menus
- Subject: hierarchical menus
- From: Boyd Collier <email@hidden>
- Date: Mon, 13 Mar 2006 16:36:22 -0800
I'm trying to create a hierarchical menu, as follows: When the user
selects my "Tools" menu on the menu bar, one of the menu items is
"Scan Data." I want the submenu that "Scan Data" shows to be a list
of open documents that the user then selects from, so this list has
to be created on the fly. Here's what I've done thus far:
- (IBAction)scanDataMenuAction:(id)sender {
NSLog(@"scan data menu item was selected"); // for testing
NSString *menuItemTitle = [(NSMenuItem*)sender title];
NSLog(@"Here's the menu item title: %@", menuItemTitle); // this
shows that the Scan Data item was selected.
NSMenu *mySubmenu = [[NSMenu alloc] initWithTitle:@"My Submenu"]; //
just for testing
[(NSMenuItem*)sender setSubmenu:mySubmenu]; // I've tried lots of
variations on this
[mySubmenu update];
}
None of the many variations I've tried on the above get the job done.
I've looked at the example "MenuMadness" but although it uses
hierarchical menus, they are set up with Interface Builder rather
than programmatically on the fly. If anyone can suggest the step(s)
I'm missing or point out some sample code, I'd really appreciate the
help.
Boyd
_______________________________________________
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