Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / January 2004



Tip: Looking for answers? Try searching our database.

combobox on mac ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
patrox - 26 Dec 2003 13:06 GMT
Hello

Is it possible to create the equivalent of a combobox on mac os X ?

I am trying to do a combobox in a dialog, using resedit.  ( yes i know it's
old :)  haven't found anything else to do the job )
I want to populate the list dynamically  if that's possible.

Thank you
patrice.
David Scrève - 26 Dec 2003 14:44 GMT
Le 26/12/03 14:06, dans 3fec3223$0$6978$7a628cd7@news.club-internet.fr,
« patrox » <misterbanned@hotmail.com> a écrit :

> Hello
>
[quoted text clipped - 6 lines]
> Thank you
> patrice.

   Panther has a true ComboBox support using HiToolBox. Have a look in this
section.

David
--
David Scrève -- "La pile Wonder ne s'use que si l'on s'en sert."
Frederick Cheung - 26 Dec 2003 15:19 GMT
> Le 26/12/03 14:06, dans 3fec3223$0$6978$7a628cd7@news.club-internet.fr,
> « patrox » <misterbanned@hotmail.com> a écrit :
[quoted text clipped - 12 lines]
>     Panther has a true ComboBox support using HiToolBox. Have a look in this
> section.
So does Jaguar (although the version of IB that comes with Jaguar doesn't
have it as part of its control palette)

Fred

> David
> --
> David Scrève -- "La pile Wonder ne s'use que si l'on s'en sert."
David Scrève - 26 Dec 2003 17:54 GMT
Le 26/12/03 16:19, dans
Pine.LNX.4.44.0312261518360.4913-100000@kern.srcf.societies.cam.ac.uk,
« Frederick Cheung » <fglc2@srcf.DUH.ucam.org> a écrit :

>>     Panther has a true ComboBox support using HiToolBox. Have a look in this
>> section.
> So does Jaguar (although the version of IB that comes with Jaguar doesn't
> have it as part of its control palette)

   I'm afraid that Jaguar does not have any ComboBox. You can do a sort of
read only combo using the popup control.

David
--
David Scrève -- "L'excès est une vertu de la passion."
Frederick Cheung - 26 Dec 2003 18:09 GMT
> Le 26/12/03 16:19, dans
> Pine.LNX.4.44.0312261518360.4913-100000@kern.srcf.societies.cam.ac.uk,
[quoted text clipped - 7 lines]
>     I'm afraid that Jaguar does not have any ComboBox. You can do a sort of
> read only combo using the popup control.

Not true. Have a look in HIView.h

Fred

> David
> --
> David Scrève -- "L'excès est une vertu de la passion."
Sean McBride - 26 Dec 2003 21:13 GMT
> Is it possible to create the equivalent of a combobox on mac os X ?

Yes.

However, the combo box is generally considered a poor piece of UI, and I
would suggest looking for an alternative.  How do you plan on using it?

Some reading:
<http://www.mackido.com/Interface/ComboBox.html>
Miro Jurisic - 26 Dec 2003 22:12 GMT
> > Is it possible to create the equivalent of a combobox on mac os X ?
>
[quoted text clipped - 5 lines]
> Some reading:
> <http://www.mackido.com/Interface/ComboBox.html>

The article you quote and the advice you give predate the existence of combo box
widgets on Mac OS X and are relevant only in the context of discussing combo box
behavior on windows in comparison to Mac OS alternatives. Mac OS X combo box
behavior is different from windows combo box behavior and that entire article
does not apply to it.

Read
<http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelin
es/XHIGControls/chapter_18_section_3.html#//apple_ref/doc/uid/TP30000359/BAAGGAHH

hth

meeroh

Signature

If this message helped you, consider buying an item
from my wish list: <http://web.meeroh.org/wishlist>

Sean McBride - 27 Dec 2003 02:56 GMT
> The article you quote and the advice you give predate the existence of combo
> box
[quoted text clipped - 3 lines]
> behavior is different from windows combo box behavior and that entire article
> does not apply to it.

Meeroh,

Of course these are good points, and I also encourage the OP to read the
HIG.  But just as people on these (and similar forums) are always asking
posters 'why?' when they ask how to code something, I believe the 'why?'
question is also imporant in a UI context.  I have seem many
applications use combo boxes where popup menus would be better.  

Consider System Preferences > Date & Time > Time Zone.  As you quoted,
the HIG says "Combo boxes are useful for displaying a list of likely
choices while still allowing the user to type in an item not in the
list."  The latter condition is not permitted in the "Closest City"
combo box, try entering a City named "blah blah".  It forbids it, and
allows only items in its predefined list.  That's what a popup menu is
for.  Also popup menus have much nicer scrolling than combo boxes, the
latter putting up an annoying scroll bar.  Combo boxes also don't allow
'cancelling' once you start scrolling, even if you move the mouse out of
the scroll bar; popup menus do.  etc. etc.

So my advice to the OP is please read the HIG and don't use the combo
box unless your usage matches the HIG; even then don't necessarily use
it.  Don't use it just because that's what your Windows app uses.
Miro Jurisic - 27 Dec 2003 07:01 GMT
> Consider System Preferences > Date & Time > Time Zone.  As you quoted, the
> HIG says "Combo boxes are useful for displaying a list of likely choices
[quoted text clipped - 6 lines]
> scrolling, even if you move the mouse out of the scroll bar; popup menus do.  
> etc. etc.

Actually, the D&T panel has a reasonable case for using a combo box: it permits
you to type in a partial city name and allows you to get auto-completion. You
can't get type-and-complete with a popup menu, and, quite frankly, I want to
type in a city name, not select it from a list of, well, too many.

Also, clicking on the popup button cancels the list, and it is cued by the
appearance of the popup button: when you click on it to display the list, the
popup button changes appearance to the standard toggle button pushed appearance.

Also, scrolling through a long list bar is heck of a lot easier in a list with a
scroll bar than it is in a menu, because the menu permits no way for you to say
"the item I want is near the middle of the menu", only "the item I want is
further down", whereas a list permits you both modes of operation.

I don't think that combo boxes are nearly as bad as you make them sound -- when
they are used right.

> So my advice to the OP is please read the HIG and don't use the combo box
> unless your usage matches the HIG; even then don't necessarily use it.  Don't
> use it just because that's what your Windows app uses.

This goes for any control and is sound advice in general. I completely agree.

meeroh

Signature

If this message helped you, consider buying an item
from my wish list: <http://web.meeroh.org/wishlist>

Sean McBride - 03 Jan 2004 23:20 GMT
> Actually, the D&T panel has a reasonable case for using a combo box: it
> permits
> you to type in a partial city name and allows you to get auto-completion. You
> can't get type-and-complete with a popup menu, and, quite frankly, I want to
> type in a city name, not select it from a list of, well, too many.

Good point.  I've been thinking about this a bit.

Popup menus lend themselves well to choosing amongst finite (but small)
choices.  The visual indication being a list from which you can choose
one thing.  Input is done by mouse, so there's no
type-ahead/auto-completion.

Edit fields lend themselves well to specifying from infinite choices.
The visual indication being a box where one can type anything.  Input is
done by keyboard, so type-ahead/auto-completion is possible (think new
Panther search edit fields)

(Yes, its a bit of a simplification, there's the accessibility stuff
allowing keyboard use of popups and Inkwell allowing tablet input for
editfields, but let's stay simple)

A combo box is a combination of 1) a popup menu and 2) an edit field.  
From the AHIG description its supposed to be for: infinite choices but
with many common predefined possibilites.  A common use I've seen is,
say, font sizes, where I can type any font size I want, but the common
ones are in the popup.

But the D&T use case is for: a large but finite number of choices.  You
cannot enter cities the OS does not know about.  The problem here is
that the combo box control's visual appearance ('box where one can type
anything') implies that the user *can* type anything.  And if one does
not allow anything to be typed one has created a UI inconsistancy.  So
what to use?  A popup is not right, because, as you said, popups should
not have billions of items.  Also there is no type-ahead/auto-completion
with popups.  Is there a correct control?  I think so: a list box!  It
provides for choosing one of a large finite set and it can support type
ahead.  One possible drawback is that it takes more space.

Curiously, I find no mention of the venerable list box in the AHIG's
'Selection Controls' section you mentionned.  But in the good old OS 8
HIG, imagine what I found:
<http://developer.apple.com/documentation/mac/HIGOS8Guide/thig-25.html>
(I love the example screenshot :) )

The AHIG does say about popup menus: 'For more than 12 items; use a
scrolling list unless space is restricted'.  They don't say what to use
if space is restricted though, but some people seem to be choosing combo
boxes.  IAC, I don't think space is restricted in the D&T case,
considering the height of that map picture!

And have you noticed that the combo box's popup component looks much
more like a list box than a popup menu.  I think some people are using
the combo box like a condensed one line list box.  Maybe such a control
is needed, but it should not be one and the same as the combo box.  They
need to look different since they do different things.  I have not
thought about what kind of visual distinction could be used.

> I don't think that combo boxes are nearly as bad as you make them sound --
> when they are used right.

I think I agree with you here now, I guess its just that I find almost
no one uses them right.

If you're still reading, thanks :)
James Spencer - 04 Jan 2004 00:43 GMT
> The AHIG does say about popup menus: 'For more than 12 items; use a
> scrolling list unless space is restricted'.  They don't say what to use
> if space is restricted though, but some people seem to be choosing combo
> boxes.  IAC, I don't think space is restricted in the D&T case,
> considering the height of that map picture!

I think the HIG are thinking the opposite way you are: if space is
restricted then use a scrolling list for less than 12 items, i.e. if
space is restricted, you might use a scrolling list with say only 8
items.

Spence
Sean McBride - 04 Jan 2004 02:35 GMT
> > The AHIG does say about popup menus: 'For more than 12 items; use a
> > scrolling list unless space is restricted'.  They don't say what to use
[quoted text clipped - 6 lines]
> space is restricted, you might use a scrolling list with say only 8
> items.

I'm afraid I don't follow you. :(  I think they are saying: if you have
12 items or less go ahead and use a popup menu (this is in the popup
menu section BTW).  If you have more than 12 items, and plenty of space,
use a scrolling list.
Miro Jurisic - 06 Jan 2004 23:38 GMT
> > I don't think that combo boxes are nearly as bad as you make them sound --
> > when they are used right.
[quoted text clipped - 3 lines]
>
> If you're still reading, thanks :)

Generally I agree with you, but I think that in the D&T case either a list or a
combo box would have been fine choices, except for the fact that a list makes
the type-select less obvious, and the combo box make it more explicit to the
user. Besides, the D&T picture looks very nice, so it deserves more space :-)

meeroh

Signature

If this message helped you, consider buying an item
from my wish list: <http://web.meeroh.org/wishlist>

patrox - 27 Dec 2003 08:43 GMT
> However, the combo box is generally considered a poor piece of UI, and I
> would suggest looking for an alternative.  How do you plan on using it?

I want to display a list of languages. ( English german etc.. )

pat.
David Phillip Oster - 27 Dec 2003 18:56 GMT
> > However, the combo box is generally considered a poor piece of UI, and I
> > would suggest looking for an alternative.  How do you plan on using it?
>
> I want to display a list of languages. ( English german etc.. )

If you are providing support for a small set of languages, then it makes
no sense to allow the user to type in something else. Use a popup menu.

If you just want to know what the user's favorite language is, but don't
intend to actually do anything with that information, think again.
patrox - 28 Dec 2003 09:20 GMT
> If you are providing support for a small set of languages, then it makes
> no sense to allow the user to type in something else. Use a popup menu.
>
> If you just want to know what the user's favorite language is, but don't
> intend to actually do anything with that information, think again.

What's the difference between a popupmenu and a combobox ?  ( it's the same
to me )

Is there a list of controls with a picture somewhere ?
pat.
Frederick Cheung - 28 Dec 2003 14:27 GMT
> > If you are providing support for a small set of languages, then it makes
> > no sense to allow the user to type in something else. Use a popup menu.
[quoted text clipped - 4 lines]
> What's the difference between a popupmenu and a combobox ?  ( it's the same
> to me )
a popup menu behaves exactly like a normal menu apart from being a
control and not part of the menu bar, whereas a combobox is a combination
of an edit control and a scrolling list, and allow you to type something
not in the list

> Is there a list of controls with a picture somewhere ?
> pat.
Look at the Aqua Human Interface Guidelines.

Fred
Kaydell - 28 Dec 2003 17:55 GMT
> Hello
>
[quoted text clipped - 6 lines]
> Thank you
> patrice.

We've used the equivalent of a combo-box with the drop-down-list
option since forever in MacOS.  We use a user-item in ResEdit and then
wrote the code to make it into what Apple calls a "pop-up menu".

Kaydell
patrox - 31 Dec 2003 14:14 GMT
We've used the equivalent of a combo-box with the drop-down-list
> option since forever in MacOS.  We use a user-item in ResEdit and then
> wrote the code to make it into what Apple calls a "pop-up menu".

Ok, a popup menu is what i wanted then ( it's called combobox with a simple
dropdrown style on pc )

sorry about that.
pat.
Kaydell - 01 Jan 2004 03:06 GMT
> We've used the equivalent of a combo-box with the drop-down-list
> > option since forever in MacOS.  We use a user-item in ResEdit and then
[quoted text clipped - 5 lines]
> sorry about that.
> pat.

No problem,

We started with popups about 16 years ago.  Modern technology would
suggest using a popup menu control instead of a user-item. (That's
what I'm told anyway, but since we've done it one way already, I'm not
sure that I should change).

Let me know if you get a popup menu control working.  One of my
co-workers has been hounding me to upgrade our popup menus to look
better.  Maybe a pop-up control would be better than what we're using
now.

Kaydell

Kaydell
David Phillip Oster - 01 Jan 2004 07:16 GMT
> > We've used the equivalent of a combo-box with the drop-down-list
> > > option since forever in MacOS.  We use a user-item in ResEdit and then
[quoted text clipped - 17 lines]
> better.  Maybe a pop-up control would be better than what we're using
> now.

Here is an example, as a .r file:

#include <types.r>

resource 'CNTL' (128) {
  {68, 64, 92, 380}, 0, visible, 60, 128, 1008, 0,
  "Number:"
};

resource 'MENU' (128) {
  128,
  textMenuProc,
  allEnabled,
  enabled,
  " ",
  {
     "1", noIcon, noKey, noMark, plain,
     "2", noIcon, noKey, noMark, plain
     "3", noIcon, noKey, noMark, plain
     "4", noIcon, noKey, noMark, plain
     "5", noIcon, noKey, noMark, plain
  }
};

resource 'DLOG' (128) {
  {89, 54, 236, 458},
  movableDBoxProc,
  invisible,
  noGoAway,
  0x0,
  128,
  "",
  alertPositionMainScreen
};

resource 'dctb' (128) {{
}};

resource 'DITL' (128, purgeable) {{
  {105, 274, 125, 349},   Button { enabled, "OK" },
  {105, 176, 125, 251},   Button { enabled, "Cancel" },
  {16, 64, 56, 384},   StaticText {   disabled,   "Your prompt here." },
  {68, 64, 92, 380},   Control { enabled, 128 }
}};

-------------------
Note that the DITL includes a Control item, which in turn references a
CNTL resource, which specifies a procID of 1008, which is the standard
for a mac popup menu (see ControlDefinitions.h) The CNTL also gives the
menu id of the menu for it to use, the width of the title area (60), and
the title.

GetControlValue gives you the ones based index of which menu item is
selected.  If you need hierarchical menus, rethink your U.I. or use
PopUpMenuSelect with a userItem.

-- David Phillip Oster
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.