Chapter Contents


SAS/AF Software: Class Dictionary

Using the Combo Box Control

Key properties to set
allowNewItems attribute Specify whether or not users can add to the list of items that appear in the combo box at run-time.

You can also query or set this attribute using SCL. For example, the following line of code enables users to add to the combo box list at run-time:

selectedItem attribute (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 = combobox1.selectedItem;

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

choice = combobox1;

Setting combo box items

You can set the items that appear in a combo box in these ways:

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 combo box items

You can specify combo box items using an SCL program.

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

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

You could just as easily fill a combo 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 combo box:

combobox1.items = colorlist1.items;

Chapter Contents



Top of Page

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