Re: Tons of fun w/NSComboBox
Re: Tons of fun w/NSComboBox
- Subject: Re: Tons of fun w/NSComboBox
- From: Don Arbow <email@hidden>
- Date: Thu, 14 Aug 2003 10:35:40 -0700
On Wednesday, August 13, 2003, at 12:52  PM, Jonathan E. Jackel wrote:
>
> 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.
>
In Cocoa, you very rarely need to subclass objects in the AppKit.  
According to the documentation for completedString: in NSComboBoxCell, 
you can do it this way:
The default implementation of this method first checks whether the 
combo box uses a data source and whether the data source responds to 
comboBox:completedString: or comboBoxCell:completedString:
Also take a look at the documentation for NSComboBoxDataSource, this 
explains the use of the completedString: method used by the data source.
Don
_______________________________________________
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.