[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 User's Guide



Using ComboBoxes

A ComboBox combines the capabilities of the TextField and List widgets. Applications use ComboBoxes to allow users to either type in information as their selection or to select information from a list of choices provided by the application. If the List contains more items than are displayed, a vertical ScrollBar appears next to the List. Figure 3-18 illustrates a ComboBox.

Figure 25. ComboBox.




View figure.

An item can be selected in a ComboBox in many ways, using either the mouse or the keyboard. To select an item using the mouse:

  1. Move the mouse pointer to the desired item.

  2. Press Button 1 on that item.

    If the ComboBox has the input focus, List items can be traversed to and selected with the keyboard by using the up or down arrow keys. Traversing to the item will select the item, as will pressing Return.

    The ComboBox illustrated in Figure 3-18 is a variation of the ComboBox called a drop-down ComboBox. In a drop-down ComboBox, the List is hidden until requested by the user. The only things showing in a drop-down ComboBox before such a request is a downward-pointing arrow next to the TextField. Figure 3-19 illustrates the drop-down ComboBox before the list has been dropped.

    Figure 26. Standard ComboBox.




    View figure.

    To drop down, or show, the List, using the mouse:

    1. Move the mouse pointer to the arrow.

    2. Press Button 1.

      The List can be unposted by pressing Button 1.

      For the keyboard, if the ComboBox has the input focus, you can press Ctrl and the down arrow or Ctrl and the up arrow to display the List. The List can be unposted by pressing Ctrl and the up arrow, Ctrl and the down arrow, Return, or Cancel. Note that pressing Returnwill not only unpost the List, but also show the current contents of the TextField.

      Some ComboBoxes have text entry fields that are non-editable. You can tell whether or not the TextField is editable by its appearance; editable text entry fields appear inset, while non-editable text entry fields do not.

      You can traverse to the ComboBox's text field whether it is editable or not, using the mouse:

      1. Move the mouse pointer to the text entry field.

      2. Press Button 1 on the field.

        To traverse to the ComboBox's TextField from the keyboard, you use the Tabkey to first get to the ComboBox.

        When the ComboBox has focus, a highlight outline, if a thick enough one was specified, is placed around the ComboBox.

        In both cases, if the TextField is editable, subsequent keystrokes apply to the editable TextField, and the selection is typed directly into it. When an item in the List is selected, the List item is highlighted. Note that if you are entering the name of an item that already exists in the List, then you must enter the item's entire name to select that item. However, ComboBox does not automatically select a List item if you type that string into the TextField. It selects the item when you Press Button 1 on the down arrow, move the focus, or hit Return or osfActivate. The application may or may not allow you to enter a selection name that does not already exist in the List. This depends on how the application is configured. For example, if the ComboBox contains a List of existing directory names, typing in a non-listed directory name should cause an error.

        If the ComboBox does not have an editable text entry field, typed text will not appear in the TextField. Instead, depending on how the ComboBox is configured, either the ComboBox will ignore what is being typed, or the ComboBox will invoke a matching algorithm. If the ComboBox is configured to activate a matching algorithm, then the ComboBox attempts to match the text, as it is being typed, with an item in the List. When the ComboBox finds a match, even if it is only from the first letter of an item, it displays the matched item in the text entry field.


      3. [ Previous | Next | Contents | Glossary | Home | Search ]