• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Case insensitive autocomplete
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Case insensitive autocomplete
      • From: Vince DeMarco <email@hidden>
    • Re: Case insensitive autocomplete
      • From: Sherm Pendley <email@hidden>
References: 
 >Case insensitive autocomplete (From: Ian was here <email@hidden>)

  • Prev by Date: Re: performKeyEquivalent and arrow keys
  • Next by Date: Re: loop efficiency & messages
  • Previous by thread: Case insensitive autocomplete
  • Next by thread: Re: Case insensitive autocomplete
  • Index(es):
    • Date
    • Thread