• 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: Tons of fun w/NSComboBox
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Tons of fun w/NSComboBox


  • Subject: RE: Tons of fun w/NSComboBox
  • From: "Jonathan E. Jackel" <email@hidden>
  • Date: Wed, 13 Aug 2003 15:52:06 -0400

> If I override (NSString *)completedString:(NSString *)substring, does it
> apply to every NSComboBox on my app, or does it apply only to a particular
> NSComboBox?

The latter. You should subclass NSComboBoxCell and write your own
implementation of completedString. In awakeFromNib, you should set the cell
of the combo cox to be an instance of your subclass. Your implementation
will work only for instances of your subclass, so it will only work for
combo boxes where you have explicitly set the cell to be your cell.

> This seems like a lot of work for something pretty trivial.

Loop through the object values. Stop when you hit one whose first n
characters match what the user has typed. If you want the comparison to be
case insensitive, convert them both to lowercase or uppercase first. Return
the matching value if there is one, nil otherwise.

Its even simpler if your list consists of items whose words are all
capitalized. Then you do:

- (NSString *)completedString:(NSString *)substring
{
return [super completedString:[substring capitalizedString]];
}

The same kind of idea could be applied to a list that is totally lowercase
or uppercase.

Doesn't seem like that much work.

Jonathan
_______________________________________________
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.

  • Follow-Ups:
    • Re: Tons of fun w/NSComboBox
      • From: Don Arbow <email@hidden>
    • Re: Tons of fun w/NSComboBox
      • From: Mike Brinkman <email@hidden>
References: 
 >Re: Tons of fun w/NSComboBox (From: Mike Brinkman <email@hidden>)

  • Prev by Date: Drawing while handling events (was Re: scribbling)
  • Next by Date: Re: Uninstaller Howto?
  • Previous by thread: Re: Tons of fun w/NSComboBox
  • Next by thread: Re: Tons of fun w/NSComboBox
  • Index(es):
    • Date
    • Thread