I have an NSCombobox in my app and I have a datasource set up for it.
IBOutlet NSComboBox *comboBox;
I also specify at some point in my program:
[comboBox reloadData];
My thought would be that after this call, I should get calls to these methods as long as I remembered to set the datasource of the combo box (which i did):
- (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(NSInteger)index
- (NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox
But I don’t. Is this not how combo boxes work?
If you’re using a combo box with a data source, and provided you can set up whatever structures the data source methods require before the combo first draws, you only need to call
reloadDataif the data subsequently changes.If the data source methods aren’t being called at all – either before or after a call to
reloadData– make sure the combo box is configured to use a data source. In the nib, under Combo Box, select Uses Data Source, or call[comboBox setUsesDataSource:YES]in code.