Re: Problems with NSComboBox delegate
Re: Problems with NSComboBox delegate
- Subject: Re: Problems with NSComboBox delegate
- From: Scott Ribe <email@hidden>
- Date: Thu, 26 Jun 2014 12:53:48 -0600
The notification's "object".
On Jun 26, 2014, at 12:44 PM, William Squires <email@hidden> wrote:
> Okay, now that my email works again... :)
> I can understand how to code my NSComboBox data source methods (my NSWindowController subclass is set as both the data source and the delegate), and the outlets set up as such in IB. The data source methods to implement:
>
> -(NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox;
> -(id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(NSInteger)index;
>
> both give me a reference to the NSComboBox in question. Easy enough.
>
> BUT... the delegate method (of interest):
>
> -(void)comboBoxSelectionDidChange:(NSNotification *)notification
>
> doesn't pass the reference to the NSComboBox whose selection changed, and I've got more than one on the window. How do I tell which combo box's selection changed? The language/SDK doc sets for "NSComboBox" are useless here, as they don't tell me what information the notification holds.
>
> Or, better yet, is there some way to use bindings to "tie" the NSComboBox (whose mode is select, rather than edit) to my controller's model's property (which is an enum that has a 1:1 correspondence between its enumeration values and the list index of the combo box in question?
>
> i.e. if I have a "typedef enum foo {selection1 = 0, selection2} FOO;" and an @property (nonatomic, assign) FOO myFooSelection; in a class whose instance the window controller exposes in its own @property. The window has an NSComboBox that has two items "selection1" and "selection2", whose list indices match the enumerated values.
>
>
>
> _______________________________________________
>
> 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
--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice
_______________________________________________
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