Re: Retriving the tag of superMenu Items
Re: Retriving the tag of superMenu Items
- Subject: Re: Retriving the tag of superMenu Items
- From: "Louis C. Sacha" <email@hidden>
- Date: Mon, 6 Dec 2004 17:39:43 -0800
Hello...
Menus don't have tags, but the menu item the menu is attached to can have one.
To get the tag of the menu item that anchors the submenu, you would
do something like this:
id <NSMenuItem> selectedMenuItem; /* given a particular menu item */
NSMenu *parentMenu = [selectedMenuItem menu];
NSMenu *grandparentMenu = [parentMenu supermenu];
id <NSMenuItem> parentMenuItem = [grandparentMenu
itemAtIndex:[grandparentMenu indexOfItemWithSubmenu:parentMenu]];
int parentTag = [parentMenuItem tag];
Hope that helps,
Louis
Hi,
I have a menu item called Fruits" with some sub menus.
Fruits
Winter
Orange
Tangerine
Summer
Strawberry
Melon
If the user choses the item "Melon", how can I get the tag of its superMenus
(items) Summer and Fruits?
I have already
- (IBAction)ChoiseFromMenuFruits:(id)sender
{
int tag = [sender tag]; // this is the tag of the item Melon
// if I ask [[sender menu] tag]
// Xcode tells me there is not tag in a menu
}
Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
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