src/swipl-devel/packages/xpce/man/refmanual/md/dialog.md

class dialog {#class-dialog}

A dialog is a window that is designed to be used for creating dialog boxes. A dialog performs automatic layout over its contents, thus largely simplifying the definition of simple dialog windows and the automatic generation of dialog windows.

Dialog windows normally only display instances of subclasses of class dialog_item. These are added to the dialog using the dialog ->append method rather than window ->display. dialog ->append places the item relative to the other items in the dialog. When the frame in which the dialog resides is created, the final positions are automatically calculated by dialog ->layout.

Dialog windows may be operated in two modes: each change to an item in the dialog immediately sends a message or pressing an apply button will apply all modifications made to the dialog. The example below illustrates a dialog of the latter type for editing some window attributes:

dialog(W) :-
    new(D, dialog('Edit Window Attributes')),
    send(D, append, label(reporter)),
    send(D, append,
         text_item(frame_label,
               W?frame?label,
               message(W?frame, label, @arg1))),
    send(D, append,
         slider(width, 50, 500, W?visible?width,
                message(W, width, @arg1))),
    send(D, append,
         slider(height, 50, 500, W?visible?height,
                message(W, height, @arg1))),
    send(D, append, button(apply)),
    send(D, append, button(restore)),
    send(D, append, button(quit, message(D, destroy))),
    send(D, default_button, apply),
    send(D, open).

?- new(@w, window),
     send(@w, open),
     dialog(@w).

This dialog may be converted into an immediate changing dialog by deleting the apply button. See ->apply, ->modified_item and ->restore for details.

@see class dialog_item

Instance variables {#class-dialog-instvars}

Send methods {#class-dialog-send}

Get methods {#class-dialog-get}



Try the rswipl package in your browser

Any scripts or data that you put into this service are public.

rswipl documentation built on June 16, 2026, 5:07 p.m.