List Box

Function Syntax (LM:listbox <msg> <lst> <bit>)
Current Version 1.2
Download ListBoxV1-2.lsp
View HTML Version ListBoxV1-2.html
Symbol Type Description
msg String Dialog title
lst List List of strings to display
bit Integer Bit-coded flag: 1=allow multiple items; 2=return item indexes
Type Description
List List of selected items or indexes; else nil if the user pressed Cancel

Function Description

This function will display a dialog with a list_box interface, allowing the user to select one or more items from the supplied data set.

The function requires three arguments: the msg string argument represents the dialog box title; the lst list argument is a list of strings to be displayed in the list box; and finally, the bit integer argument is a bit-coded flag to determine the list box behaviour.

If the bit argument contains bit-code 1, the user may select multiple items from the list box; omitting this bit-code will restrict the user to selecting a single item.

If the bit argument contains bit-code 2, the function will return a list of zero-based integer indexes representing the positions of the selected items in the supplied list; excluding this bit-code will cause the function to instead return a list of the selected items.

If the user clicks the OK button to accept the selected items, the function will return a list of the selected items or indexes from the supplied data list; otherwise this function will return nil if either the dialog could not be loaded or the user has pressed the Cancel button before submitting a selection.

Example Function Call

The following example function call will display the dialog as shown in the graphic below and will return the list as shown if the user accepts the displayed selection.

_$ (LM:listbox "Select an Item" '("Item 1" "Item 2" "Item 3" "Item 4" "Item 5") 1)
("Item 1" "Item 3")
List Box Example


increase · reset · decrease

Designed & Created by Lee Mac © 2010