Chapter Contents


SAS/AF Software: Class Dictionary

Using the List Box Control

Key Properties to set
List Box Control: selectedItem (default attribute) Specify which of the list items you want selected by default.

You can also query this attribute to find out what the user has selected. For example, the following line of SCL code queries the item that is currently selected:

choice = listbox1.selectedItem;

Note:   The following line of code is also valid since the selectedItem attribute is the default attribute:

choice = listbox1;
List Box Control: title Specify the title of the list box.

You can also query or set this attribute using SCL. For example, the following line of SCL code sets the title of the list box to 'Colors.'


Setting list box items

You must tell every list box control what items to display. Use one of the following ways to add items to a list box control:

Build-time attributes

The following attribute is a build-time attribute, meaning it can only be set at build-time if you choose to use it:

Using SCL to specify list box items

You can specify list box items using an SCL program.

For example, the following code creates a list and assigns the list to a list box:

petList = makelist(); 
rc = insertc(petList, 'Dog', -1); 
rc = insertc(petList, 'Cat', -1); 
rc = insertc(petList, 'Bird', -1);
listbox1.items = petList;

You could just as easily fill a list box with a list of items that already exists in a model that you have instantiated. The following code assigns color list model items to a list box:

listbox1.items = colorlist1.items;

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.