Re: setting menuitem state...
Re: setting menuitem state...
- Subject: Re: setting menuitem state...
- From: Jonathan Jackel <email@hidden>
- Date: Mon, 26 Jan 2004 17:14:39 -0500
This came up earlier today. This test:
if ([tempDict valueForKey:@"status"])
is true if there is a "status" key in the dictionary, regardless of
whether that status is YES or NO. Try:
if([[tempDict objectForKey:@"status"] boolValue])
Jonathan
On Jan 26, 2004, at 2:57 PM, email@hidden wrote:
ok so this is supposed to let the user turn on or off multiple items in
the popupbutton menu but even if status is NO it doesn't set the menu
item to NSOffState...i can't figure out why i've check it and the item
is a bool set to no but it doesn't work it will set the NSOnState once
then they just stay on?
- (void)menuWillPopUp:(NSNotification *)aNotification;
{
NSMenuItem *item;
NSEnumerator *enumerator = [[nameMenu itemArray] objectEnumerator];
while(item = [enumerator nextObject])
{
if (![item isSeparatorItem])
{
NSMutableDictionary *tempDict = [NSMutableDictionary dictionary];
[tempDict addEntriesFromDictionary:[ABFieldsDict valueForKey:[item
title]]];
if ([tempDict valueForKey:@"status"])
{
[[nameMenu itemWithTitle:[item title]] setState:NSOnState];
}
else
{
[[nameMenu itemWithTitle:[item title]] setState:NSOffState];
}
}
}
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.