• 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: Vince DeMarco <email@hidden>
  • Date: Wed, 23 Mar 2005 10:05:54 -0800


On Mar 23, 2005, at 9:11 AM, Nicko van Someren wrote:

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:




Interface builder doesn't let you set a custom class for a cell used by NSComboBox, but it does let you set the custom class for a matrix. So the no code way of doing this is to drag in a combo box and alt drag to make it a matrix of 1x2 then set the custom class of the first cell to MyComboCell, the make it a 1x1 matrix (only one item)


Vince

_______________________________________________
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: Nicko van Someren <email@hidden>
References: 
 >Case insensitive autocomplete (From: Ian was here <email@hidden>)
 >Re: Case insensitive autocomplete (From: Nicko van Someren <email@hidden>)

  • Prev by Date: Re: Cocoa coding style (was loop efficiency & messages)
  • Next by Date: NSMutableArray, NSArrayController and NSTableView
  • Previous by thread: Re: Case insensitive autocomplete
  • Next by thread: Re: Case insensitive autocomplete
  • Index(es):
    • Date
    • Thread