List box
List box (English listbox ) is the name of a control element (control, component) a graphical user interface (GUI).
The, also referred to as a selection list GUI component is used to display user-selectable entries in list form. The entries are usually textual data to nature, but also the appearance of icons or combinations of text and image are possible. A distinction is made between different types of list boxes.
The normal list box is multiline. For ergonomic reasons, it is recommended to make it at least four lines. Since the list usually are more entries than the field has lines, a vertical scroll bar ( scrollbar ) is used for scrolling (scroll ) within the list.
In addition to multi-line list box permanently visible, but there is the space-saving single-line drop-down list box ( drop-down list box, drop-down list ). When you view the full list displays only when you press the corresponding button in the form of a menu ( popup menu, context menu ), which allows the selection of an entry.
The combination of a list box and a text box ( text field) for direct input and output is called a combo box ( combo box ).
Which entries - as proposals for selection by the user - are displayed at which time the list box depends on the programming of the application. Of the implementation details of the list box in a computer program, it also depends on whether only one or more items can be selected. In single-line fields, only one entry can be selected in the rule.
Examples
Java
In the Java language, there are different listboxes
AWT
- The multiline list box is called java.awt.List
- The one-line drop-down list box is called java.awt.Choice
Swing
- The multiline list box is called javax.swing.JList
- The one-line drop-down list box is called javax.swing.JComboBox. Since this is a combo box, you must define whether it should be used only to select or to also accept input from the built-in text box ( setEditable (true) ).
HTML
In the HTML markup language, there is only the element
- The one-line list box is created with
- The multiline list box is created with
Excel Visual Basic
This example transfers the data from an Excel spreadsheet in the list box. It is limited to three columns, but can be extended.
- Download an Excel file ( such as addresses ) or create such a file. Save the file under the name " listbox ".
- Create a UserForm named " UserForm1 " and a list box with the label " Listbox1 ".
- Copy the following UserForm Code: Private Sub UserForm_Initialize () ' Fill listbox ListBox1.ColumnCount = 3 ListBox1.BoundColumn = 0 ListBox1.RowSource = " mappe.xls A1: C3" end Sub
- Graphical User Interface