• 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
NSArrayController, NSPopupMenu, defaults and arrangedObjects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSArrayController, NSPopupMenu, defaults and arrangedObjects


  • Subject: NSArrayController, NSPopupMenu, defaults and arrangedObjects
  • From: Steven Hamilton <email@hidden>
  • Date: Mon, 8 Dec 2008 19:01:05 +1000

Hi folks,
I've got a single NSPopupButton. The content is bound to an NSArrayController arrangedObjects and value bound an attribute. All good. THe ArrayController is sourcing a Core Data store for its array and this is all good too. The problem is when the window is loaded the NSPopupButton is showing "No Value" which I assume is because it hasn't been told which object in the array it should be showing by default. I have the NSPopupButton SelectedObject bound to an NSManageObject *selectedAccount variable in my custom window controller.


Moving the NSPopup correctly points my selectedObject variable at the object chosen. However, in my attempts to remove the default "No Value" I'm attempting to set the SelectedObject variable to the first object in the array.

selectedObject = [[myArrayController arrangedObjects] objectAtIndex:0];

This doesn't work as the arrangedObject array is empty. NSLog returns a count of zero.

This is the correct way to set the default on an NSPopup isn't it? I set the bound selectedValue, not the control itself. Why is my arrangedObjects array empty on window load?
_______________________________________________


Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Fixed width of left pane in NSSplitView
  • Next by Date: Re: Fixed width of left pane in NSSplitView
  • Previous by thread: Re: Fixed width of left pane in NSSplitView
  • Next by thread: Re: NSArrayController, NSPopupMenu, defaults and arrangedObjects
  • Index(es):
    • Date
    • Thread