Re: Case insensitive autocomplete
Re: Case insensitive autocomplete
- Subject: Re: Case insensitive autocomplete
- From: Nicko van Someren <email@hidden>
- Date: Wed, 23 Mar 2005 17:11:09 +0000
On 23 Mar 2005, at 16:05, Ian was here wrote:
Does anyone know how to make an NSComboBoxCell do case
insensitive autocomplete? Like the way Interface
Builder does when typing in actions and outlets for a
class.
The class NSComboBoxCell has a message completedString: which handles
the completion process. I suspect you'll need to subclass the cell
class and reimplement this to do case insensitive completion.
Unfortunately Interface Builder does not seem to allow you to set
custom classes for the cell used by the NSComboBox. One convenient way
I've found to deal with this is to also produce a trivial subclass of
the control as well as the cell, with an implementation of something
like:
@implementation MyComboBox
- (id)initWithCoder:(NSCoder *)decoder {
// Load everything up as per normal
self = [super initWithCoder: decoder];
NSArchiver *a = [[NSArchiver alloc] initForWritingWithMutableData:
[NSMutableData dataWithCapacity: 256]];
[a encodeClassName: @"NSComboBoxCell" intoClassName: @"MyComboCell"];
[a encodeRootObject: [self cell]];
[self setCell: [NSUnarchiver unarchiveObjectWithData: [a
archiverData]]];
return self;
}
@end
Doing this allows you to use Interface Builder to place things with
custom cells without having to write code for every custom object to
tweak the cell and it will work as long as your subclass of the cell
does not have it's own, different implementation of initWithCoder:
Nicko
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden