NSComboBoxCell auto completion
NSComboBoxCell auto completion
- Subject: NSComboBoxCell auto completion
- From: Ivan Myrvold <email@hidden>
- Date: Fri, 9 May 2003 16:01:25 +0200
I have some problems implementing auto completion for a NSComboBoxCell
in an NSTableView.
I have added self as an observer to NSControlTextDidChangeNotification
with getItemsInTable as the selector.
Here is the code for it:
- (void)getItemsInTable:(NSNotification *)notification {
NSText *fieldEditor = [[notification userInfo]
objectForKey:@"NSFieldEditor"];
NSTableColumn combocolumn = [[[notification object] tableColumns]
objectAtIndex:0];
NSComboBoxCell *comboCell = [combocolumn dataCell];
int row = [[notification object] selectedRow];
NSString *startchars = [fieldEditor string];
( select something from mydatabase where myfield like chars% )
... getting an array from database to populate the comboCell, where
the array have items all starting with startchars
When I start typing in the NSComboBoxCell, I do not get any auto
completion, but if I after having typed a few characters press the
enter key, which selects the recently typed characters, and then press
the right arrow to set the insertion point after the typed characters,
I suddenly have auto completion.
All this is working flawlessly for a single NSComboBox. I just wonder
what the difference between NSComboBox and NSComboBoxCell could be?
Ivan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.