Enabling the X Button to Close

Description

The following example shows how to close a modeless Xdialog box when the user clicks its (close) button.

Example 

First, the {CAN_EXIT} command enables the close button and generates a "close" event.

ui_modeless_dlg_box("Name",<<%dlg%
{can_exit=close}

Then, the event code captures the "close" event and uses UI_MODELESS_DLG_CLOSE() to close the dialog.

Name: [.20name];
{lf};
<Show Name!name> <Close>;
%dlg%,<<%code%
if (a_dlg_button = "close") then
    ui_modeless_dlg_close("name")
    end
end if
if (a_dlg_button = "name") then
    if name <> "" then
        ui_msg_box("Hello","Hello " + name)
    else
        ui_msg_box("Hello","Please type in your name")
    end if
    end
end if
%code%)

Limitations

Desktop applications only.

See Also