Back to Check Box Object
Up to Table of Contents
Ahead to Graphic Object

Combo Box Object

Combo Boxes provide lists of items from which the user can select by clicking on an item. Use the Combo Box tool to draw the object. The tool appears as follows:

Combo Box Object Appearance

The following figure shows an example of how a Combo Box might appear within Jamba.

Items that you enter in the list cannot be seen in the Page Layout Editor. However, the following figure shows how a Combo Box might appear at runtime.

You determine the size of the object when you draw it. If there are too many items to all be visible at once, the object has a scrollbar. Use the Font and TextColor properties to control the font and color of characters in the Combo Box. The ColorBackground property sets the color of the area behind the text.

Use the ItemList property to specify the items that you want to appear in the object's list. The ItemList property lets you open the ItemList Properties dialog box.

Type each item, pressing Return to start a new item line. The "Selected item number" field lets you identify which item you want to be selected when the object first displays. The default is -1 which means that none of the items are selected. Specify 1 to select the first item in the list, specify 2 to select the second item, and so on. Note that this characteristic can also be set via the SelectedItemNumber property. When you are finished entering items, press OK to close the dialog box and return the items to the ItemList property.

Capturing the User's Input

When a user makes a selection from a list at runtime, the object's SelectedItemData property is set to the item that the user selected. In effect, the application uses this property to "capture" the user's input. Your application can use this information to set another property or method at runtime.

If you want to manipulate the captured value, you refer to it using the Object.Property syntax. For example, if you want to manipulate the value currently stored in the SelectedItemData property of ComboBox1, you would specify the value ComboBox1.SelectedItemData.

Acting on the User's Input

There are two ways to use a value captured in the SelectedItemData property. The first method does not use CGI and the second does. The following two subsections describe how to use the Combo Box with and without using CGI programming.

Combo Boxes without CGI

An application can use the value captured by the SelectedItemData property to set another property that uses the same kind of value that the user selected. For example, consider an application that contains ComboBox1 and Audio1. You can set up the list so that it displays several audio filenames. You can then instruct the user to select a filename from the list. When the user selects an item, it is captured by the SelectedItemData property. You can then set the Filename property of Audio1 using ComboBox1.SelectedItemData.

Combo Boxes with CGI

By using a CGI object to call a CGI program, you can greatly enhance the power of Combo Boxes in your applications. When a user selects a value, you can send the SelectedItemData property out to a CGI program. The CGI program can evaluate the information and return information that sets a property or method of an object.

For example, an application can let a user select a type of animal which is then sent to a CGI program. The CGI program evaluates the data and sends back information that causes an Audio object to play an audio file appropriate for the selected animal. (Note that unlike the preceding example that did not use CGI, the list does not have to explicitly contain filenames.) This example application would use ComboBox1, CGI1 and Audio1. The following paragraphs describe how the various objects are set up.

ComboBox1 - The object displays a list of animals, such as cats, dogs, and horses. The user is instructed to select the animal he or she wants to hear. When the user makes a selection, a Select event is triggered. The To Do List for the Select event is set up to run the CGI object.

CGI1 - The ParameterList property would be set to send ComboBox1.SelecteItemData (which equals the name of an animal). The Response property would be set to True so that the CGI object expects return information. The CGI program is coded to determine which animal has been selected. It returns the name of the audio file to play in Audio1, using the syntax Audio1.Filename= "filename.au".

Audio1 - The Audio object has its Filename property set by the CGI program. It then plays the specified file.

For more information, see the section entitled "CGI object."

Lesson: Combo Boxes

See the section called "Lesson: User-Defined Actions" in Chapter 2 for a lesson on creating an application that uses a List Box. Note that the Combo Box functions almost identically to the List Box object. The only difference is that all the items in the Combo Box list are seen only when the user clicks on the drop-down arrow.

Combo Box Object Properties, Methods, and Events

The Combo Box objects support the following properties, methods, and events:

Properties Methods Events
BackgroundColor MoveAndSize() Create
Enabled SlideTo() Hide
Font
 
Select
Height
 
Show
HowToHide
 
SlideToComplete
HowToShow
 
 
ItemList
 
 
Name
 
 
SelectedItemData
 
 
SelectedItemNumber
 
 
TextColor
 
 
Visible
 
 
Width
 
 
X
 
 
Y
 
 

Back to Check Box Object
Up to Table of Contents
Ahead to Graphic Object