In this section:
This format supplies a simple list-box facility. The corresponding arguments are an array of CHARACTER strings, an INTEGER argument giving the size of the array and an INTEGER argument that both sets the initial selection and returns the result.
For example:
INTEGER k
CHARACTER greek(4)*5
DATA (greek(i),i=1,4)/'alpha','beta','gamma','delta'/
k=1
i=winio@('Select a Greek letter: %7.3ls',greek,4L,k)
END
The characters "7.3" before "ls" specify the width of the list box (as the number of characters) and the depth of the list box (as the number of lines). Pre-setting k to 1 would cause "alpha" to be already highlighted when the window is displayed. If the user selects "beta", then k set to 2. If k were pre-set to zero, none of the items would be initially selected. If the user were to exit without making a selection, k would keep its pre-set value.
The grave accent (`) may be used with %ls (List Box (or Combo Box)) to produce a drop-down combo box rather than a list box (for an editable combo box see %el (Editable Combo Box) ). The caret (^) character is used in association with a call-back function. This function will be called whenever an item is selected.
For example:
EXTERNAL ls_function
i=winio@('%^ls',array,6L,n,ls_function)
(See also the LISTBOX_ITEM_SELECTED parameter in CLEARWIN_INFO@).
For a list box (i.e. when a grave accent modifier is not used), the option hscrollbar provides a horizontal scroll bar whilst the option multicolumn provides a multiple column display. For example:
CHARACTER*8 fruit(7)
DATA fruit/'Apples','Bananas','Cherries','Grapes',
+ 'Oranges','Pears','Plums'/
i=winio@('%24.4LS[multicolumn]',fruit,7,k)
Combining hscrollbar with multicolumn gives a horizontal scroll bar that selects one column at a time.