Re: Programatically opening a NSComboBox?
Re: Programatically opening a NSComboBox?
- Subject: Re: Programatically opening a NSComboBox?
- From: Nicholas Riley <email@hidden>
- Date: Mon, 17 Mar 2003 08:20:34 -0600
- Mail-followup-to: petite_abeille <email@hidden>, email@hidden
On Mon, Mar 17, 2003 at 01:02:53PM +0100, petite_abeille wrote:
>
How does one programatically open a NSComboBox (e.g. trigger the combo
>
box's pop up to display)?
Not easily, seemingly. This works, but for the button not
highlighting and behaving weirdly the next time you click on it:
[[cbox cell] popUp: nil];
And this works, but for the button continuing to be highlighted until
the next time you manually pop up the box:
[[[cbox cell] valueForKey: @"_buttonCell"] performClick: nil];
This problem is easily worked around by using a (documented)
notification and setting the state of the NSButtonCell directly. As
you might imagine, the action of the NSButtonCell is set to
-[NSComboBoxCell popUp:].
If you need this functionality, please file a bug. It seems Apple's
own applications (e.g. iChat) which need to override popup button
opening set the action directly on the combo box cell's button cell,
to do something other than the normal action of -[NSComboBoxCell
popUp:]. It would seem simpler to me to just override popUp:, but
it's really just trading one undocumented method for another.
--
=Nicholas Riley <email@hidden> | <
http://www.uiuc.edu/ph/www/njriley>
Pablo Research Group, Department of Computer Science and
Medical Scholars Program, University of Illinois at Urbana-Champaign
_______________________________________________
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.