NSPopupButton fun & games (newbie)
NSPopupButton fun & games (newbie)
- Subject: NSPopupButton fun & games (newbie)
- From: Duncan Campbell <email@hidden>
- Date: Tue, 12 Apr 2005 17:38:54 +1000
Hi folks.
I'm trying to create a popup button, but am having some difficulty.
Just as a test, I tried using the following code:
[[myPopupMenu cell] setUsesItemFromMenu:NO];
NSMenu *mnu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@""];
NSMenuItem *item;
item = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:@"test item1" action:@selector(myMethod:) keyEquivalent:@""];
[item setTag:0];
[mnu addItem:item];
[item release];
item = [[NSMenuItem allocWithZone:[NSMenu menuZone]] initWithTitle:@"test item2" action:@selector(myMethod:) keyEquivalent:@""];
[item setTag:1];
[mnu addItem:item];
[item release];
[myPopupMenu setMenu:mnu];
What happens is that I only get 1 menu item (the 2nd one), and it is disabled.
Can anyone let me know what i'm doing wrong? I took a look at the menu madness demo without too much insight.
Cheers.
---------------------------------------------------------------
Duncan Campbell
http://www.duncanandsarah.com/duncan
---------------------------------------------------------------
... in three to eight years we will have a machine with the general
intelligence of an average human being ... The machine will begin
to educate itself with fantastic speed. In a few months it will be
at genius level and a few months after that its powers will be
incalculable ...
-- Marvin Minsky, LIFE Magazine, November 20, 1970
_______________________________________________
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