• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: setting menuitem state...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >setting menuitem state... (From: email@hidden)

  • Prev by Date: Re: Need help with SQLite
  • Next by Date: Re: drawing view pieces into images
  • Previous by thread: setting menuitem state...
  • Next by thread: Re: setting menuitem state...
  • Index(es):
    • Date
    • Thread