Setting Choices for List and Combo Boxes
A data field displayed as a list box accepts only values that are in its choice list. A data field displayed as a combo box accepts both values in the list and new values entered by the user. These images show a list box in regular and combo box formats.
Select the control, choose Object > Properties and display the Setup tab.
Select "List Box" or "Combo Box" in the Field-Type list.
Display the Choices tab.
Select one of the Choices for control. The options are:
" User Defined "
" Computed Automatically "
" Populated using Xbasic "
User Defined Choices
If you selected "User Defined" in step 4:
1. Select the display style. The options are:
"Bitmap followed by text"
"Bitmap over text"
"Text followed by bitmap"
"Text over bitmap"
2. Enter choices one per line. Refer to Specifying User Defined Choices.
3. Optionally, click or the 'ZA down' icon to sort the entries in ascending or descending order.
4. If the selection in step 5a included bitmaps, click Define bitmaps... to display the Define Bitmaps dialog box. Otherwise, click OK to save your choices definition.
5. In the Define Bitmaps dialog box select each entry in turn and click Define Bitmap to display the Define Picture dialog box.
6. In the Define Picture dialog box optionally check Button displays a different picture when a button is pressed. This causes the Pressed tab to appear.
7. Optionally, on the Default tab click Embedded and Select Embedded Bitmap. Navigate to the image, select it, and click Open.
8. Optionally, on the Default tab click File and the 'up' button. Navigate to the image, select it, and click Open.
9. Optionally, on the Default tab click Internal and the 'up' button. Select the image from the Insert Image dialog box, and click Insert.
10. If the Pressed tab is visible, display it, and select another image in the same manner as Described by steps 5h through 5j.
11. Click OK, OK and OK to save your choices definition.
Choices Automatically Computed
If you selected "Computed Automatically" in step 4 Select a data Source. The options are: :
" Values from a Table/Set "
" Field List "
" Expression (that returns a CR-LF delimited list) "
Values from a Table/Set
If you selected "Values from a Table/Set" in step 6a:
1. Select a table or set in the From Table list.
2. Do one of the following:
Select a field to display in the Field/expression field.
Select "" in the Field/expression field to display the Expression Builder. Enter an expression that defines values to display and click OK.
This expression may return more than one field as long as they are separated by "|" characters (e.g. Product_Name + "|" + Product_No ). Only the first field will display in the list box.
Optionally, click the 'up down arrow' icon to display the Order Builder to order the list choices that will appear.
A filter expression selects values from a lookup table based on one or more values in the current table. Optionally check Enable Filter Expression and click Edit Filter Expression to display the Filter Expression dialog box.
Optionally, check Display only unique keys to avoid duplicate entries in the list.
Optionally, click Preview to see the data that the list will contain.
Click OK to save your choices.
If you selected "Field List" in step 6a, select the table or set in the Display fields for which table? list.
CR-LF Delimited List
If you selected "Expression (that returns a CR-LF delimited list)" in step 6a:
1. In the Expression field enter an expression or function that returns a list of CR-LF delimited values. Optionally, click the 'xy' button to display the Expression Builder dialog box.
2. Optionally, enter an expression in the Watch Expression field. When this value changes, Alpha Anywhere will refresh the choice list.
3. Optionally, click Preview to see the data that the list will contain.
4. Click OK to save your choices.
Lists of Layouts and Operations
If you selected a list of layouts or operations in step 6a:
1. Click OK to save your property settings.
2. Right click on the form and select Events > OnInit.
3. In the Create new Event Script dialog select Create using Xbasic and click OK.
4. Enter Xbasic code structured as follows. Substitute your control's name for .
5. Optionally, substitute your list of choices, one per line, for:
... DIM pObj as P pObj = topparent:.this pObj.settings.dynamic_list = <<%str% ... %str%
Optionally, substitute a call to a function that returns a CR-LF delimited list for:
<<%str% ... %str% DIM pObj as P pObj = topparent:.this pObj.settings.dynamic_list = MyFunction()