Skip to content

pyui.create_list_box

fabian-flassig edited this page Jul 24, 2024 · 5 revisions

Create a list box for the user to select one of multiple options. Use insert_control_item to populate the list box with options and reset_content to clear the list box. Call set_control_selection to initialize the selection status.

Note that radio buttons and drop lists are another way to present multiple options to the user.

pyui.create_list_box(dialog, col_spec)
dialog:create_list_box(col_spec)

Parameters

Type Description
dialog dialog_handle Dialog where the control is created
col_spec integer or {first, last} Index of the column or specification of the column-span, where the control is placed.

Return value

Type Description
control_handle A handle to the newly created control

Remarks:

The length of a list box is calculated from the number of adjacent rows. Fine-tuning of the length can be achieved by inserting alignments and empty elements.

Events

When the user changes the selected option of a list box, the on_change handler is called on_change_handler(text, new_index) with one string argument of the selected text and one integer argument for the index of the newly selected option.

Version requirements

This function is available in V26 and above.

See also

Control Gallery, insert_control_item, set_control_selection, reset_content, set_on_change_handler, create_drop_list, create_radio_button, create_align, create_empty

Clone this wiki locally