Record List - List Box Control Syntax

Syntax

[%KL=Index_Query_Name%[.Width[,Height]]Variable_Name[!rl_*][?Enabled]]

[%@FormatVariable%[.Width[,Height]]Variable_Name[!rl_*][?Enabled]]

Note: You must not have any space characters in the finished command.

Argument

Type

Description

Index_Query_Name

C

The name of the index or query (query.description).
FormatVariable

C

When combined with "@" allows the control to read its formatting instructions from the variable named FormatVariable.
Width

N

The width of the control.
Height

N

The height of the control.
Variable_Name

C

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_*

C

Optional. See Event Syntax.
Enabled

L

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): [Picture]

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 Five",<<%dlg%
{region}
[%kl=customer,{keylist_build("H=.025,1:25[Customer_Id],2:25[Firstname],3:25[Lastname],4:25[Bill_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}
<OK><Cancel>{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:25[Customer_Id],2:25[Firstname],3:25[Lastname],4:25[Bill_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 Five 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 Five 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

Xdialog Language Directives and Operators, Xdialog Control Reference

Supported By

Alpha Five Version 5 and Above