Re: NSComboBox
Re: NSComboBox
- Subject: Re: NSComboBox
- From: Alastair Houghton <email@hidden>
- Date: Thu, 26 Jul 2018 09:45:42 +0100
On 26 Jul 2018, at 01:18, Casey McDermott <email@hidden> wrote:
>
> We have a 1/2 decent version working right now based on NSTextField. It shows
> a scrolling table
> with a NSWindowController, and selects from the table (and beeps if not
> there). It also
> has a NSPopUpButton on the side to use as an additional option (handy for
> short lists
> or if the user is already mousing). Basically, that is the same approach we
> use/used in the
> C++ version (PowerPlant, Carbon).
>
> But, getting all the details to work just right has been extremely difficult.
> NSComboBox
> is sooooo close, and so much less futzing. Also, the combo box in Windows
> MFC
> does exactly what we need, and it would be nice if both platforms looked the
> same.
>
> One big beef I have is that it's not possible to step into Cocoa source,
> unlike PowerPlant
> or MFC. It makes it much harder to understand what's going on inside Cocoa.
To be fair, in the case of MFC some of it (like the combobox) relies on
underlying Windows controls that you also don’t have the source for.
NSComboBox is pretty unusual in a Mac application; you don’t see many of them
about, and I think that’s because there are often better options (particularly
in cases like yours where you say there may be thousands of possible choices),
not to mention the fact that historically the NSComboBox looked rather ugly
compared to other Aqua controls. You might also consider using something like
NSTokenField (check out the To and Cc fields in Apple Mail for an idea of what
that might look like).
Someone suggested looking at the Cocotron source; that isn’t a bad idea —
though Cocotron’s implementations are sometimes rather simpler than the ones in
the Cocoa framework — and you could also look at GNUStep’s sources to see how
it does things. Neither, of course, guarantees that Apple/NeXT chose the same
approach, although in many cases the API itself does dictate some of the
details of how it works under the covers; if you want to know how it really
works, grab yourself a copy of Hopper <https://www.hopperapp.com
<https://www.hopperapp.com/>> (or IDA, or even just do it the old fashioned way
using otool) and disassemble the relevant framework.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden