Xbasic

UI_MODELESS_DLG_BOX Function

Syntax

V UI_MODELESS_DLG_BOX(C title,C dialog_format[,C code])

Arguments

title

The title of the dialog. The title may also be specified dynamically using the syntax: Title = "@=" + Title_Var_Name.

dialog_format

A series of Xdialog commands that describe the appearance of the dialog box. The Format section has the following structure:

Format = <<%dlg%
Xdialog_Code
%dlg%
Argument
Description
<<%dlg%

The only optional part of this argument is the "dlg" sequence of characters (the marker), which can be any string of characters, as long as it is unique within this instance of the UI_DLG_BOX() function. The character sequence <<%dlg% is specifically recommended because it is supported by bubble help.

Xdialog_Code

One or more statements, each of which must be on a separate line from the <<%dlg% and %dlg% arguments.

%dlg%

The marker characters can be any string of characters, as long as they match those in the first argument ( <<%dlg% ).

code

Optional. Xbasic code that describes what should happen when various events happen when the user is interacting with the dialog box. For example, what should happen when the user presses a button, or when the user tabs out of a field. The Code section has the following structure:

Code = <<%code%
Xbasic_Code
%code%

Description

Create a modeless dialog box - optional script to handle button requests is the third argument.

Discussion

The UI_MODELESS_DLG_BOX() function creates a modeless dialog.

Example

This example displays a simple modeless dialog box.

dim title as c
title = "Basic Modeless Dialog"
ui_modeless_dlg_box(title,<<%dlg%
{title=This is the dialog title}
{xmargin=10}
{ymargin=2}
{can_exit=exit}
Try clicking the X in top right corner to close dialog.;
{lf};
<20,2Click Here!MyButton>;
;
%dlg%,<<%code%
if a_dlg_button = "close" then 
    ui_modeless_dlg_close(title)
end if 
if a_dlg_button="MyButton"
    ui_modeless_dlg_close(title)
end if
if a_dlg_button = "exit" then 'handle clicking on the X close button
    q = ui_msg_box("Warning", "Are you sure?", ui_yes_no)
    if q = ui_yes_selected then
        ui_modeless_dlg_close(title)
    end if
    a_dlg_button = "" 'clear value
    'if the user selects No, the dialog will remain open
end if
%code%)

Limitations

Desktop applications only.

See Also