• 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
Binding NSPopupButton to a set of NSObjects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Binding NSPopupButton to a set of NSObjects


  • Subject: Binding NSPopupButton to a set of NSObjects
  • From: Bob Peterson <email@hidden>
  • Date: Thu, 2 Feb 2006 14:15:58 -0500

This is a rank newbie question, but the documentation and list archives just aren't helping me. What I want to do is display a set of arbitrary objects and know which object was selected. Using selectedIndex seems more than a little indirect and hokey. How do I directly see the selection as one of the objects that is part of the displayed set?

#include "B.h"
@interface A : NSObject {
	B* currentB;
	NSSet* allBs;
}

@interface B : NSObject {
	NSString* name;
	//...plus many other instance variables...
}

In my nib I have an instanceA1 which is an A. Using IB, I want to bind an NSPopupButton to instanceA1's allBs property. I'll display each B's "name" property in the popup. Any time I want to know what the currently selected B is, I find out by just looking at currentB, which has been bound to that NSPopupButton, too, somehow. And more, when I change currentB I want that to change the selection in the NSPopupButton.

But I just can't grok which bindings get bound where. For example, I can't find anything in the documentation to explain what is the 'attribute' (or is it a 'property') named "contentObjects", as seen in Interface Builder's bindings inspector for an NSPopupButton. Clicking the help button there displays a page with the heading "No pages with your search words were found". When I looked in the manual for NSPopupButton and NSArrayController Bindings, there is no obvious mention of this.

I -have- been able to display B.name. I can even set up the sort descriptor and use arrangedObjects. But that's as far as I have gotten.

Thanks all,
\bob
_______________________________________________
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


References: 
 >Preferred hight of NSTextField (From: Kaspar Mösinger <email@hidden>)

  • Prev by Date: Preferred hight of NSTextField
  • Next by Date: Keyboard navigation for a view
  • Previous by thread: Preferred hight of NSTextField
  • Next by thread: Re: Preferred hight of NSTextField
  • Index(es):
    • Date
    • Thread