Multiple selection box - %n.mms

In this section:

%ms (Multi-select Box) creates a list box that allows the user to select more than one item at a time. It is similar to %ls (List Box (or Combo Box)) but the variable returning the result is replaced by an integer array. The elements of this array should be initialised to a value of zero for initially de-selected items and to a value of 1 for selected items. The array is updated as the user changes the selection.

n and m are optional (m cannot be specified without n). n represents the width of the multiple selection box (as a number of characters) and m the depth (as the number of lines). %ms (Multi-select Box) requires three arguments. The first is an array of CHARACTER strings; the second is the number of entries in the list; and the third is an array of type INTEGER. The two arrays must have the same number of elements. If the number of elements that are displayed is less than the number in the list then a vertical scroll bar is provided. If a call-back function is supplied then it is called each time the user selects an item.

The following program illustrates some typical cases:

   INCLUDE <windows.ins>
   INTEGER k,i
   INTEGER ivec(7)
   CHARACTER*10 things(7)
   DATA things/'Apples','Bananas','Cherries','Grapes',
  + 'Oranges', 'Pears', 'Raspberries'/
c--- Set the initial values for the selections ---
   DATA ivec/0,1,0,0,1,1,0/
   i=winio@('%ca[Selecting things]&')
   i=winio@('Multiple selection%nl%tc[black]&')
   i=winio@('%ff%nlNote that the first three boxes are&)
   i=winio@('coupled together%nl&')
   i=winio@('because they share the result variable k')



Copyright © 1999-2024 Silverfrost Limited