Rollup Modeless Dialog Boxes

Description

The following example shows how to create a modeless dialog that can be rolled up to occupy less screen space. This type of dialog box is frequently used for toolboxes. First define the two variations of the <<%dlg%...%dlg% code for dialog boxes, using the same button names.

dim dialog_box_title as C
dialog_box_title = "Test"
dlg_expanded = <<%dlg%
{can_exit=close}
{position=remember=test_dialog}
This is the expanded dialog.;
{lf};
{text=50,10};
;
%dlg%
dlg_contracted = <<%dlg%
{can_exit=close}
{position=remember=test_dialog}
This is the rolled-up dialog.;
{lf};
;
%dlg%

Next, create two sets of <<%code%...%code% event handlers. Note how each treats the Rollup button, by loading the other version of the dialog box.

event_expanded = <<%code%
if a_dlg_button = "close" then
    ui_modeless_dlg_close(dialog_box_title)
end if
if a_dlg_button = "rollup" then
    ui_modeless_dlg_box(dialog_box_title, dlg_contracted, event_contracted)
end if
%code%
event_contracted = <<%code%
if a_dlg_button = "close" then
    ui_modeless_dlg_close(dialog_box_title)
end if
if a_dlg_button = "rolldown" then
    ui_modeless_dlg_box(dialog_box_title, dlg_expanded, event_expanded)
end if
%code%

Now, start the ball rolling by loading the expanded version of the two dialog boxes.

ui_modeless_dlg_box(dialog_box_title, dlg_expanded, event_expanded)

The two dialog boxes appear below.

Limitations

Desktop applications only

See Also