Specifying User Defined Choices
Description
This topic describes how to enter user defined choices for the following form control types:
list box and combo box
radio button group
multi-state button
tree-control and drop-down tree control
The choices displayed by the control are defined on the Choices tab of the control's Properties dialog box. In the case of a tree-control a period is used to delimit the different levels in the tree. For example, if you want to display a list of cities in a list box or combo box, you would specify the choices as follows (one choice per line):
Boston New York Atlanta Los Angeles San Francisco Johannesburg
These images show a list box in regular and combo box formats.
There are several additional optional parameters that you can specify for each choice. The parameters are all delimited with the vertical bar character. For each choice, you can specify the following parameters:
Label |[ Value ]|[ Bitmap_Type | Bitmap_Name |[ Pressed_Bitmap_Type | Pressed_Bitmap_Name ]]
Label
The label that appears in the list box. This parameter is required.
Value
Optional. Default = Label. The value that is stored by Alpha Anywhere in the field when the user selects the corresponding label.
Bitmap_Type
Optional. The type of the bitmap to use. Alpha Anywhere will automatically create all of the bitmap parameters for you if click the Define bitmaps ... button. However, if you know the name of the bitmap that you want for each choice, entering the parameters directly into the text box is quicker. The options are:
"E" = Embedded bitmap (i.e. the bitmap is stored inside the form).
"F" = The bitmap is a file
"I" = The bitmap is selected from the bitmap library, or from Alpha Anywhere's built-in bitmaps.
Bitmap_Name
Optional. The name of the bitmap to display.
Pressed_Bitmap_Type
Optional. In the case of a multi-state button, when the button is pressed you can specify a different bitmap to display.
Pressed_Bitmap_Name
Optional. The name of the pressed bitmap.
Examples
Assume you have defined a list box or combo box to display product names. You could specify the choices as follows:
Alpha Anywhere|100 Alpha Anywhere Runtime|101 Alpha Anywhere Application Server|102
The list box or combo box will display the names of the products. When the user makes a selection, the corresponding value (100, 101 etc.) will be stored in the field. Assume you have defined a radio button group. Also, assume that for each radio button you want to display text and an image, which you do by selecting "Bitmap followed by text" as the "Display" option. You could specify the choices as follows:
Print|Print|I|$a5_print Preview|Preview|I|$a5_preview Save|Save|I|
This will display a radio button group with two radio buttons, "Print" and "Preview". For each button, there will be a corresponding bitmap selected from Alpha Anywhere's built-in list of bitmaps. When the user selects a radio button, the value stored in the field is either "Print" or "Preview" Assume you have defined a tree control and you want the tree control to display the following tree:
Massachusetts Boston Cambridge Weston New York Albany Ithaca New York City
You would specify the choices as follows:
Massachusetts.Boston Massachusetts.Cambridge Massachusetts.Weston New York.Albany New York.Ithaca New York.New York City
These images show a tree control in regular and drop-down formats.
If you also want to control the stored value, you would use the standard syntax to specify the stored value by including |stored value after each entry.
MA
Boston
23 Main St.
2 Circle Drive
Cambridge
1 Memorial Drive
NY
New York
1 Madison Ave.
2 Lexington Ave.
Ithaca
34 Coddington St.
The data for this tree control could be entered as follows:
MA^Boston^23 Main St. MA^Boston^2 Circle Drive MA^Cambridge^1 Memorial Drive NY^New York^1 Madison Ave. NY^New York^2 Lexington Ave. NY^Ithaca^34 Coddington St.
In the above example, the ^ character is the delimiter between levels on the tree control, but you can specify any delimiter character that you want. You must choose a delimiter that does not appear in your data. If you are populating the tree control automatically with values from a table, then you must specify an expression that returns values from table in the correct format. In the above example, the hierarchy is State, City, Address. Assume that the table from which you were populating data had fields called "State", "City" and "Address". Also assume that the delimiter you had specified was the ^ character. The expression that you would need to specify would be:
Alltrim(state)+"^"+alltrim(city)+"^"+alltrim(address)
See Also