Difference between revisions of "Projects/Usability/HIG/Combo Box"

< Projects‎ | Usability‎ | HIG
Jump to: navigation, search
(Code snippets: => Implementation)
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
  
Combo boxes offer the user a choice of two or more mutually exclusive options. Their disadvantage compared to related controls like radio buttons or lists is that the options are not visible without further interaction.  
+
== Purpose ==
 +
A ''drop-down list'' is a GUI control which allows the user to choose one value from a list. When a drop-down list is inactive, it displays a single value. When activated, it displays (drops down) a list of values, from which the user may select one. When the user selects a new value, the control reverts to its inactive state, displaying the selected value. A drop-down list works similar to a list box but hides the complete list until the user initiate the drop down. The disadvantage of drop-down lists compared to related controls like radio buttons or lists is that the options are not visible without further interaction.
  
* Use combo boxes instead of radio buttons for more than four mutually exclusive options.  
+
A ''combo box'' is a combination of a drop-down list and an edit control, thus allowing users to enter a value that isn't in the list. It behaves like a drop-down list and allows the user to choose from a list of existing items but adds the option to type a value directly into the control. Newly typed items are usually added to the list and can be selected next time. Combo boxes are typically applied to provide autocomplete or autotype functionality in a convenient way to the user.
* Don't use them for less than three options or more than 10 choices. In the latter case, use lists instead.
+
 
* In general, controls that show the options without further user interaction are preferable, except for the following cases:
+
Both type of lists provide autocomplete feature for the whole string, independently of the "editable" property. Given the items of "bike", "boat", and "car": 
 +
*If one types "b", the list selects "bike".
 +
*If one (rapidly) types "bo", it selects "boat".
 +
*If one types "c", it selects "car".
 +
The input field of the combo box ("editable" is true) marks the completed part of the item as selected, making it easy to change the completion. When "editable" is false, i.e. drop-down list, one can repeatedly type a letter to cycle through items starting with this letter.
 +
 
 +
== Guidelines ==
 +
 
 +
* Use a drop-down list for single selection of one out of many items.
 +
* Use a combo box for drop-down lists that can be extended by the user.
 +
* For only a few options, consider to use a set of [[Projects/Usability/HIG/Radio_Buttons|radio buttons]].
 +
* For a single selection out of a large number of items (n>20), use a [[Projects/Usability/HIG/ListView| list view]].
 +
* Prefer controls that show the options without further user interaction, except for the following cases:
 
** the list of options may change over time,
 
** the list of options may change over time,
 
** the contents are obvious from the label and the one selected item, for example ''Month'' and ''January''
 
** the contents are obvious from the label and the one selected item, for example ''Month'' and ''January''
 
** the combo box is part of a related sequence of controls. For example, to set a reminder to ring 5 hours or minutes before or after an event.
 
** the combo box is part of a related sequence of controls. For example, to set a reminder to ring 5 hours or minutes before or after an event.
* Provide a descriptive label to the left (in left-to-right scripts), in some cases above the combo box. Don't forget to create a buddy relation so access keys are assigned.
+
* Drop-down lists and combo boxes can be distinguished visually (normally by the raised or lowered bevel). Do not override the common processing, e.g. by using a combo box and making it read only in order to simulate a simple drop-down list.
* Don't initiate an action when the user selects an item from a drop-down list.
+
* Label the combo box with a descriptive label to the left of the combo box (cf. [[Projects/Usability/HIG/Form_Label_Alignment| Alignment]]).
* Make sure the items are easily accessible via keyboard by moving distinctive letters to the beginning of each option. For example, in a list of countries on continents, write ''Germany (Europe)'' instead of ''Europe/Germany''.
+
* Create a buddy relation so access keys are assigned.
 +
* Show a maximum of eight items at once (maxVisibleItems=8).
 +
* When possible apply changes immediately but do not initiate an action (like print, send, delete) when the user selects an item from a drop-down list.
 +
* Do not have blank list items; use meta-options, e.g. (None) instead
 +
* Do not add controls to the drop-down (e.g. check boxes for each item).
 +
* Place options that represent general options (e.g. all, none) at the beginning of the list.
 +
* Sort list items in a logical order. Make sure sorting fits translation.
 
* Use sentence style capitalization for the label and the options.
 
* Use sentence style capitalization for the label and the options.
* If activating a choice affects the appearance or the enabled state of other controls, place them next to the radio button or in the next row (indented).
+
* If activating a choice affects the appearance or the enabled state of other controls, place them next to the combo box or below the combo box with a space indentation.
 +
* Make sure the items are easily accessible via keyboard by moving distinctive letters to the beginning of each option. For example, in a list of countries on continents, write ''Germany (Europe)'' instead of ''Europe/Germany''.
 +
 
 +
== Implementation ==
 +
[http://api.kde.org/4.10-api/kdelibs-apidocs/kdeui/html/classKComboBox.html KComboBox]

Revision as of 14:27, 27 June 2013


Purpose

A drop-down list is a GUI control which allows the user to choose one value from a list. When a drop-down list is inactive, it displays a single value. When activated, it displays (drops down) a list of values, from which the user may select one. When the user selects a new value, the control reverts to its inactive state, displaying the selected value. A drop-down list works similar to a list box but hides the complete list until the user initiate the drop down. The disadvantage of drop-down lists compared to related controls like radio buttons or lists is that the options are not visible without further interaction.

A combo box is a combination of a drop-down list and an edit control, thus allowing users to enter a value that isn't in the list. It behaves like a drop-down list and allows the user to choose from a list of existing items but adds the option to type a value directly into the control. Newly typed items are usually added to the list and can be selected next time. Combo boxes are typically applied to provide autocomplete or autotype functionality in a convenient way to the user.

Both type of lists provide autocomplete feature for the whole string, independently of the "editable" property. Given the items of "bike", "boat", and "car":

  • If one types "b", the list selects "bike".
  • If one (rapidly) types "bo", it selects "boat".
  • If one types "c", it selects "car".

The input field of the combo box ("editable" is true) marks the completed part of the item as selected, making it easy to change the completion. When "editable" is false, i.e. drop-down list, one can repeatedly type a letter to cycle through items starting with this letter.

Guidelines

  • Use a drop-down list for single selection of one out of many items.
  • Use a combo box for drop-down lists that can be extended by the user.
  • For only a few options, consider to use a set of radio buttons.
  • For a single selection out of a large number of items (n>20), use a list view.
  • Prefer controls that show the options without further user interaction, except for the following cases:
    • the list of options may change over time,
    • the contents are obvious from the label and the one selected item, for example Month and January
    • the combo box is part of a related sequence of controls. For example, to set a reminder to ring 5 hours or minutes before or after an event.
  • Drop-down lists and combo boxes can be distinguished visually (normally by the raised or lowered bevel). Do not override the common processing, e.g. by using a combo box and making it read only in order to simulate a simple drop-down list.
  • Label the combo box with a descriptive label to the left of the combo box (cf. Alignment).
  • Create a buddy relation so access keys are assigned.
  • Show a maximum of eight items at once (maxVisibleItems=8).
  • When possible apply changes immediately but do not initiate an action (like print, send, delete) when the user selects an item from a drop-down list.
  • Do not have blank list items; use meta-options, e.g. (None) instead
  • Do not add controls to the drop-down (e.g. check boxes for each item).
  • Place options that represent general options (e.g. all, none) at the beginning of the list.
  • Sort list items in a logical order. Make sure sorting fits translation.
  • Use sentence style capitalization for the label and the options.
  • If activating a choice affects the appearance or the enabled state of other controls, place them next to the combo box or below the combo box with a space indentation.
  • Make sure the items are easily accessible via keyboard by moving distinctive letters to the beginning of each option. For example, in a list of countries on continents, write Germany (Europe) instead of Europe/Germany.

Implementation

KComboBox


KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal