Record List - List Box Control Syntax
Syntax
[%KL= Index_Query_Name % [. Width [, Height ]] Variable_Name [ ! rl_* ][ ? Enabled ] ]
[%@ FormatVariable % [. Width [, Height ]] Variable_Name [ ! rl_* ][ ? Enabled ] ]
Arguments
- Index_Query_Name
Character. The name of the index or query ( query.description ).
- FormatVariable
>Character. When combined with "@" allows the control to read its formatting instructions from the variable named FormatVariable.
- Width
Numeric. The width of the control.
- Height
Numeric. The height of the control.
- Variable_Name
>Character. The name of a character variable to receive the user selection, or a numeric variable to receive the index value of the selected radio button. The index of the top-most button is 1. An initial NULL value places the selection line at the top of the list. When Variable_Name has a value found in the list, the selection line will be placed on that value.
- rl_*
>Character. Optional. See Event Syntax.
- Enabled
Logical. Optional. See Enabled Syntax.
Description
The Record List - List Box Control provides a dynamic view of selected records and fields from a table or set.
Example
For example, the following script creates a list box 50 characters wide and 10 lines tall based on the query named "Keylist" ( query.description ):
tbl = table.reset("clients") tbl.query_detach_all() query.order = "lastname+firstname" query.filter = ".t." query.description = "Keylist" indx = tbl.query_create() ui_dlg_box("Simple Record List",<<%dlg% Print a mailing label for which customer?; {lf}; Select customer lastname:; %KL=keylist%.50,10key_selected; {lf}; <*15&OK!ok> <15&Cancel!cancel> %dlg%,<<%code% if a_dlg_button = "ok" then filter_expression = "lastname+firstname = '"+key_selected+"'" label.Preview("mail_labels",filter_expression) end if %code%)
Macro Expansion Symbol
If you created an Xdialog with a record list list box, you would typically use this syntax.
ui_dlg_box("Alpha Anywhere",<<%dlg% {region} [%kl=customer,{keylist_build("H=.025,1:25Customer_Id,2:25Firstname,3:25Lastname,4:25Bill_State_Region",+Customer_id,left(+Customer_id,25),left(+Firstname,25),left(+Lastname,25),left(''+Bill_state_region,25))}{Bill_state_region = "ma"}"%.100,10rl]; {endregion}; {line=1,0}; {region} {endregion}; %dlg%)
You will notice that the syntax for the record list is %format string%.100,10rl. This creates a record list that is 100 columns wide, and 10 lines high. The format string that defines the record list is:
kl=customer,{keylist_build("H=.025,1:25Customer_Id,2:25Firstname,3:25Lastname,4:25Bill_State_Region",+Customer_id,left(+Customer_id,25),left(+Firstname,25),left(+Lastname,25),left(''+Bill_state_region,25))}{Bill_state_region = "ma"}"
If the control definition is written as %@formatStringVariable%.100,10rl, then Alpha Anywhere sees that the format definition for the control ( all controls on an Xdialog have an optional format specification that is contained between pairs of % signs) is @formatStringVariable. The @ tells Alpha Anywhere that the format string is not defined here directly, but instead by a variable called formatStringVariable, and to evaluate that variable to get the actual format string. There are a limited number of places in an Xdialog format string where the @ (macro expansion) symbol is recognized. Record list controls are one of those places.
See Also