Helpful Information
 
 
Category: Apache Flex
CombBox vs PopupButton vs PopupMenuButton

These controls seem to perform the same basic function. Can anyone point me to a decent description of when I would use one control vs the other?:confused:

Its all up to your taste. ;-)

Also see

http://blog.flexexamples.com/2008/04/09/creating-a-custom-sort-on-a-datagrid-control-in-flex/

I just went through hell using this control.:mad: Didn't realize that the left button dispatches an itemClick event as well as a click event. This makes it nearly impossible to determine whether the user clicked a selection of the menu or just clicked the button. My boss turned me on to this control thinking it was what I was looking for. Not so. I wanted a button to pop-up a menu. Not change the button behavior dynamically via user selection of a menu item. The use of this control is what is confusing people. It's not a menu provider. It's a dynamic button who's functionality can be changed by the user via menu selections. It's a very cool control when used for it's intended purpose. But try using it as a menu and it will fight you all the way.
Now, the popupButton, parent to the popupMenuButton, can popup anything derived from UIComponent. So I popped up a menu. This controls button does NOT dispatch an itemClick event when clicked as it's child, popupMenuButton, does. That's a big difference. One allows the developer to present the user with any UIComponent be it a calender, password type input, list of items etc... The other allows a user to set the functionality of the button at runtime. Very powerfull. But it is not a menu provider and should not be used as such. It's name, popupMenuButton is very missleading.

The use of this control is what is confusing people. It's not a menu provider.
I disagree. It is, in fact, a menu provider - with the added feature of allowing a user-selectable default action. As you stated, it is very powerful - as a menu provider. While it may, depending on your approach, bring additional programmer-work to the table, that is no reason to avoid its use. Especially in cases where a user may want to establish a default action for a particular session there is no control better suited.

The popupMenuButton is what it is - a custom control, albeit one provided by Adobe. The better approach is to learn the techniques necessary to use this control as it was intended.

To the original question:
While these controls do provide similar functionality, that functionality is not necessarily exactly the same.

The Combobox: while it can be used (with the proper techniques) to function as a menu selection choice, its primary function is similar to that of a <select> tag in html - to provide a limited number of values to a particular prompt, as opposed to requiring the user to manually enter a value. This can be used to help the user and to the programmer by limiting the user-selected values to a pre-determined list of acceptable choices - a "white-list", if you will.

The PopupMenuButton: is designed to pop-up a menu, and thereby providing a list of available actions (as opposed to values) for the user to select (assuming it is used properly).

The PopupButton: can be used to pop-up a menu but also (as NorthernPike noted) it can pop-up any UIComponent - which may present a possible action (or actions) or a possible value (or values) depending on the context in which it is used.

The deciding factors are (1) the context in which the control is to be used, and (2) the GUI used by the application. In other words ...

Its all up to your taste. ;-)










privacy (GDPR)