Re: Programatically opening a NSComboBox?
Re: Programatically opening a NSComboBox?
- Subject: Re: Programatically opening a NSComboBox?
- From: petite_abeille <email@hidden>
- Date: Mon, 17 Mar 2003 16:00:47 +0100
Hi Nicholas,
On Monday, Mar 17, 2003, at 15:20 Europe/Zurich, Nicholas Riley wrote:
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];
I ended up doing just that... sigh...
I'm using performSelector:withObject:afterDelay: though... haven't
notice any "weird behavior" so far. I'm sure it will come in due time
;-)
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];
I see... weirder and weirder ;-) By the way, is '_buttonCell' the thing
I need to kill to get ride of this goofy button on the right side of
the combo box? Anyway to make this button go away?
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.
Ummm... very cheesy :-(
In any case, this is what I ended up doing:
Added performSelector:@selector(popUp:) withObject:afterDelay: in
controlTextDidChange:
To compensate for those extra popUp, I also added
cancelPreviousPerformRequestsWithTarget: in comboBoxWillDismiss: to
avoid some weird flickering.
Seems to behave properly now.
Cheers,
PA.
_______________________________________________
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.