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 protected])
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]