Macros and the IBM CognosScript Language  7.5.0
IBM CognosScript Statements and Functions >

ComboBox Statement

Description

Creates a combination text box and list box in a dialog box.

Syntax A

ComboBoxx , y , dx , dy , text$ , .field

Syntax B

ComboBoxx , y , dx , dy , stringarray$ , .field

where:

is:

x , y

The upper left corner coordinates of the list box, relative to the upper left corner of the dialog box.

dx , dy

The width and height of the combo box in which the user enters or selects text.

text$

A string containing the selections for the combo box.

stringarray$

An array of dynamic strings for the selections in the combo box.

.field

The name of the dialog-record field that will hold the text string entered in the text box or chosen from the list box.

Comments

The x argument is measured in 1/4 system-font character-width units. The y argument is measured in 1/8 system-font character-width units. (See Begin Dialog for more information.)

The text$ argument must be defined, using a Dim Statement, before the Begin Dialog statement is executed. The arguments in the text$ string are tab delimited as shown in the following example:

dimname = "listchoice"+Chr$(9)+"listchoice"+Chr$(9)+"listchoice"...

The string in the text box will be recorded in the field designated by the .field argument when the OK button (or any pushbutton other than Cancel) is pushed. The field argument is also used by the dialog statements that act on this control.

Use the ComboBox statement only between a Begin Dialog and an End Dialog statement.

Example

This example defines a dialog box with a combination list and text box and three buttons.

Sub main
   Dim ComboBox1() as String
   ReDim ComboBox1(0)
   ComboBox1(0)=Dir("C:\*.*")
   Begin Dialog UserDialog 166, 142, "CognosScript Dialog
Box"
      Text  9, 3, 69, 13, "Filename:", .Text1
      ComboBox  9, 14, 81, 119, ComboBox1(), .ComboBox1
      OKButton  101, 6, 54, 14
      CancelButton  101, 26, 54, 14
      PushButton 101, 52, 54, 14, "Help", .Push1
   End Dialog
   Dim mydialog as UserDialog
   On Error Resume Next
   Dialog mydialog
   If Err=102 then
      MsgBox "Dialog box canceled."
   End If
End Sub

See Also

Begin Dialog...End Dialog Statement

Button Statement

ButtonGroup Statement

CancelButton Statement

Caption Statement

CheckBox Statement

DropComboBox Statement

DropListBox Statement

GroupBox Statement [IBM CognosScript Extension]

ListBox Statement

OKButton Statement

OptionButton Statement

OptionGroup Statement

Picture Statement

StaticComboBox Statement

Text Statement

TextBox Statement