Re: NSTableView with imbedded NSComboBoxCell problem
Re: NSTableView with imbedded NSComboBoxCell problem
- Subject: Re: NSTableView with imbedded NSComboBoxCell problem
- From: Matt Neuburg <email@hidden>
- Date: Fri, 30 Jul 2004 10:27:46 -0700
On Thu, 29 Jul 2004 21:57:53 -0500, Tony Cate <email@hidden> said:
>
>On Thu, 29 Jul 2004 17:39:22 -0500, Tony Cate <email@hidden> said:
>
>I have built a table that uses a NSComboBoxCell in one of the columns. I was
>
>surprized to learn the bcellb doesnbt have any delegate methods. In
>
>particular, I was looking for - (void)comboBoxWillPopUp: so I can select a row
>
>and scroll it into view.
>
>>
>
>>Can someone tell me how to detect the popup so I can select a row, etc.
>
>
>
>Hint: an NSComboBoxCell is an NSActionCell. m.
>
>
>
>
I had hopes there, but the cell doesnbt send it action until either a return
or an item is selected from the popup list. I need notification before the
popup, pops up. Or at the very least concurrent with the popup.
After some private correspondence with Tony, I got a little clearer on what
he wants to do. He is expecting the user to type for a bit in the combobox
text field, then pop up the list, and he wants the right item of the list to
be selected at that moment.
I pointed out that if you turn on autocompletion this happens automatically:
the user simply has to type for a bit, press down-arrow, and presto, the
right thing happens. So the behavior desired is built right in; it's just a
question of knowing how to use the interface, I think.
If you have a data source for the combobox cell, you can implement
autocompletion yourself, and do the selection and scrolling yourself:
// figure out i, the index in the list
[aComboBoxCell selectItemAtIndex: i];
[aComboBoxCell scrollItemAtIndexToTop: i];
For even more fine control, you can add a formatter so you can catch what's
going on as the user types.
In any case I really don't think comboBoxWillPopUp is needed here. There are
plenty of ways to learn that the user is typing and to respond by doing
things with the selection and scrolling of the list. As with so much of
Cocoa (or any framework), the best approach is to let the framework itself
tell you what to do. m.
--
matt neuburg, phd = email@hidden, <
http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<
http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
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.