Xbasic

{CONDITION}

Syntax

{CONDITION= (expression )} ... {REGION= Label } ... {ENDREGION}

Arguments

Expression

Character. A logical variable or expression that evaluates to .T. (TRUE) or .F. (FALSE).

Label

Character. A unique label for the region that the condition applies to.

Description

The {CONDITION} command allows the display of Xdialog elements to be turned on or off, depending on how a logical expression is evaluated.

payby = 1
ui_dlg_box("Title",<<%dlg%
{region=a}
Name:|[.40name];
{endregion};
{region}
Paid by: (payby={Cash,Check,Credit Card});
{endregion};
{condition=(payby=3)}
{region=a}
Credit Card Number: |[.40number];
{endregion};
{condition=.t.}
{region=a}
Ship Via: |[.40ship_via];
{endregion}
%dlg%)

This script produces this dialog when the condition is FALSE:

images/XD_Conditional_1.gif

And, it produces this dialog when the condition is TRUE:

images/XD_Conditional_2.gif

As you can see, when the condition is .F. (FALSE), the space that would have been taken up by the Credit Card Number controls is still taken up.

Limitations

Desktop applications only

See Also