FROM : Cameron Hotchkies
DATE : Thu May 08 02:45:08 2008
Hi all,
In an app I'm working on, I need a ComboBox that pulls it's contents
from a database. I did this by attaching a datasource. I have the
(case insensitive) autocomplete working, everything seemed to be going
well. My datasource class implements the following functions:
- (id)comboBox:(NSComboBox *)aComboBox
objectValueForItemAtIndex:(NSInteger)index;
- (NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox;
- (NSString *)comboBox:(NSComboBox *)aComboBox
completedString:(NSString *)uncompletedString;
- (NSUInteger)comboBox:(NSComboBox *)aComboBox
indexOfItemWithStringValue:(NSString *)aString;
With NSLog() calls, I've verified they appear to be working correctly
(including the indexOfItemWithStringValue: selector)
The problem I've been having is the following calls (detailsUsername
is an NSComboBox*):
NSLog(@"Looks like you chose #%d: %@ %@", [detailsUsername
indexOfSelectedItem], [detailsUsername objectValueOfSelectedItem],
[detailsUsername stringValue]);
produce:
Looks like you chose #0: (null) (null)
if this NSLog() is in the comboBoxSelectionDidChange: function, and I
replace the actual ComboBox with the casted notification argument, it
appears stringValue works, and -1 is the returned index. But any
attempts to call selectItemAtIndex: fail to change the selected index
value.
Is this something that should automatically be working? or is it
standard to have to catch this in the comboBoxSelectionDidChange
delegate?
And is there something obvious I'm missing as to why this is not
changing the selection?
Thanks.
DATE : Thu May 08 02:45:08 2008
Hi all,
In an app I'm working on, I need a ComboBox that pulls it's contents
from a database. I did this by attaching a datasource. I have the
(case insensitive) autocomplete working, everything seemed to be going
well. My datasource class implements the following functions:
- (id)comboBox:(NSComboBox *)aComboBox
objectValueForItemAtIndex:(NSInteger)index;
- (NSInteger)numberOfItemsInComboBox:(NSComboBox *)aComboBox;
- (NSString *)comboBox:(NSComboBox *)aComboBox
completedString:(NSString *)uncompletedString;
- (NSUInteger)comboBox:(NSComboBox *)aComboBox
indexOfItemWithStringValue:(NSString *)aString;
With NSLog() calls, I've verified they appear to be working correctly
(including the indexOfItemWithStringValue: selector)
The problem I've been having is the following calls (detailsUsername
is an NSComboBox*):
NSLog(@"Looks like you chose #%d: %@ %@", [detailsUsername
indexOfSelectedItem], [detailsUsername objectValueOfSelectedItem],
[detailsUsername stringValue]);
produce:
Looks like you chose #0: (null) (null)
if this NSLog() is in the comboBoxSelectionDidChange: function, and I
replace the actual ComboBox with the casted notification argument, it
appears stringValue works, and -1 is the returned index. But any
attempts to call selectItemAtIndex: fail to change the selected index
value.
Is this something that should automatically be working? or is it
standard to have to catch this in the comboBoxSelectionDidChange
delegate?
And is there something obvious I'm missing as to why this is not
changing the selection?
Thanks.
| Related mails | Author | Date |
|---|---|---|
| No related mails found. | ||






Cocoa mail archive

