hiShowListBox
hiShowListBox(?names_listBoxHandle?choiceslt_listItems?callbacks_callback[?titlet_listBoxTitle] [?multipleSelectg_multiSelect] [?valuelt_selectedItem] [?appDatag_appData] [?applyButtong_applyButton] ) =>t / nil
Description
Creates and displays a list box. The list box displays a list of strings. The list box can be created so that one item is selectable or multiple items are selectable. While the list box is displayed on the screen, the user may change the items in the list box, or change the item(s) selected. The list box remains on the screen until the user selects OK or Cancel. The list box is destroyed when it is removed from the screen.
Arguments
Values Returned
The list box symbol is reset to nil after the callback has been executed, and the list box is dismissed from the screen.
Examples
Creates and display a list box showing various flowers. The user should be able to select all of his/her favorite flowers.
hiShowListBox(?name ’myLB
?title "Pick your favorite flowers"
?choices list("daffodil" "lily" "freesia" "rose" "carnation")
?value list("rose" "freesia")
?callback ’myListBoxCB
?multipleSelect t )
; This procedure is called when the user selects OK or
; Cancel on the list box
procedure(myListBoxCB(okPressed listbox "go")
; if user pressed OK, save the selected flowers
if( okPressed saveFlowers(listbox->value) )
)
; Change the list of flowers being displayed
myLB->choices = list("petunia" "tiger lily"
"bird of paradise" "chrysanthemum")
; Select a flower
myLB->value = list("bird of paradise")
;;; trShowListBox generates a new list box displayingaListprocedure( trShowListBox( aList )
let( ( listBoxSymbol )
listBoxSymbol = gensym( 'trExampleListBox )
hiShowListBox(
?name listBoxSymbol
?choices aList
?callback 'trExampleListBoxCB
?title sprintf( nil "List Box: %L" listBoxSymbol )
?multipleSelect t
?applyButton t
)
) ; let
) ; procedure
procedure( trExampleListBoxCB( ok theListBox )
"The callback routine"
println( list( ok theListBox->value ) )
) ; procedure
To test your application, create two different list boxes and verify that the two list boxes behave independently:
trShowListBox( '( "apple" "orange" "kiwi" ) )
trShowListBox( '( "wood" "water" "metal" ) )
Creates a list box that displays all the functions matching the specified pattern.
procedure( trFunctionListBox( pattern )
"uses trListFunctions to compose a Show List Box"
hiShowListBox(
?name gensym( 'trFunctionListBoxHandle )
?title sprintf( nil "Matching: %s" pattern )
?choices trListFunctions( pattern )
?callback ’trFunctionListBoxCB
?applyButton t
?multipleSelect t
) ; hiShowListBox
) ; procedure
procedure( trListFunctions( pattern )
"returns a list of functions for the matching pattern"
foreach( mapcar fun listFunctions( pattern )
get_pname( fun )
)
) ; procedure
procedure( trFunctionListBoxCB( ok theListBox )
let( ( theArglist )
when( ok
foreach( funName theListBox->value
theArglist = arglist(makeSymbol(funName))
if( theArglist
then
printf("\n%s%L" funName theArglist)
else
printf( "\n%s()" funName )
) ; if
) ; foreach
) ; when
) ; let
) ; procedure
To find all the functions that start with "hiGet", type the following command in the CIW:
trFunctionListBox( "^hiGet" )
Additional Information
You can select mechanism for multiple selection in list boxes using hiShowListBox:
To select a continuous range of items:
- Press the left mouse button.
- Drag the cursor over the items you wish to select.
- Release the mouse button.
Each time the left mouse button is pressed, a new selection process begins, and the previously selected items are unselected.
- Press and hold the Shift key.
- Move to the new endpoint of selected items.
- Press the left mouse button.
The items between the initial start point and the new endpoint are selected; any previous selections are not unselected.
To add or delete items from the selected set:
- Press and hold the Control key.
- Move to the item you wish to add or delete.
- Press the left mouse button (inverts the selection state of this item).
- Drag the mouse button, if you wish to add or delete a range of items.
The item(s) selected or unselected gets added to or deleted from the selected set. Any previous selections remain unaffected.
Related Topics
Return to top