Setting NSPopUpMenu title adds it to end
Setting NSPopUpMenu title adds it to end
- Subject: Setting NSPopUpMenu title adds it to end
- From: Ivan Myrvold <email@hidden>
- Date: Thu, 31 Jan 2002 18:37:16 +0100
I am trying to replace the menu item in an NSPopUpButton that is shown
with another string.
It works, but with an added drawback. It adds the new title to the end
of the popup menu items. Here is the code I used in my action method
(odiagnoseno2 is the outlet to the NSPopUpButton):
NSString *mySelectedItem = [[odiagnoseno2 selectedItem] title];
NSString *sdiagnoseno2 = nil;
if (mySelectedItem != nil)
sdiagnoseno2 = [diagnose2ReverseDefault
objectForKey:mySelectedItem];
[odiagnoseno2 setTitle:sdiagnoseno2];
The last method call sets the title of the NSPopUpButton. Is this how
this method is supposed to work? What difference then is it with the
method:
addItemWithTitle:
- (void)addItemWithTitle:(NSString *)title
Adds an item named title to the end of the menu.