Hello,
in my application I have a NSObjectController bound to all controls on the user interface. This works fine so far. The only problem I have is binding the selection of an NSComboBox to the same ObjectController. As far as I found out today the value of a ComboBox is always a string so the field in the Class of the OBjectController...
Im trying to get the selected index of a NSComboBox that has a datasource by using indexOfSelectedItem.
[combobox setUsesDataSource:YES];
[combobox setDataSource:dataSource];
[combobox selectItemAtIndex:1];
int idx =[combobox indexOfSelectedItem];
idx will always returns -1;
Getting the same results even when defining a internal list...
For the life of me, I am being continually stumped with NSComboBox.
I created an object that conforms the NSComboBoxDataSource protocol, and implemented:
- (NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox;
- (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(NSInteger)index;
I set the instance of my NSComboBox...
Is it possible to have the values displayed in an NSComboBox be different from what is retrieved with objectValueOfSelectedItem?
So, it will display an object's string name but it's int recordId is returned instead of the string name? Other than using selected index and getting it from the source array, of course...
...
Imagine if you will a Core Data app with two entities (Employee, and Department). Employees have a to-one relationship with department (department) and the inverse is a to-many relationship (employees). In the UI you can select individual Employee entities and edit the details in a detail area (there are of course other attributes and th...
I'm adding strings to a NSComboBox using -addItemObjectWithValue, and the items are appearing when the application is run.
However, right after adding the items, if I check the -numberOfItems, I get 1, even though there are more than that. From there, any data I try I pull back out is wrong.
I'm adding the items as part of -awakeFromN...
I have several NSComboBoxes created in Interface Builder, and one created programmatically.
The NSComboBoxes created in Interface Builder are perfect. I have their Value bound to the Shared User Default Controller, and when their view is opened they are sitting there with the correct value. Importantly, this value is shown as "normal"...
I have an NSComboBox and I was wondering if there is an easy way to convert it to an ordinary NSTextField? Considering NSCombBox is a subclass of NSTextField, I would think there is an easy way to turn this on/off but I can't figure it out.
...
I know that this is probably a simple question but here is what I'm racking my brain to figure this out:
I know that this:
- (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(NSInteger)index {
return [midiModelContents objectAtIndex:index];
}
will return the item at the index provided. My question is, what code do I n...