QT Class RadDialog

 

Overview

The RadDialog class implements a generic dialog window which can be populated with various GUI controls (see the setLayout method). The dialog window differs from the main window behavior by refusing to give up control until the GUI user has performed the requested action. Once the GUI user performs the requested action, the dialog window disappears. Only one dialog window can be displayed at a time.

Dialog window displayed over an Editor window

Here a dialog window is displayed over an Editor Window showing the functions in the Lisp source being edited. The dialog window disappears when the Close Window "X" is clicked. The Lisp source file Ais/Tutorial_IDE/ideMgr.sl contain the code which creates this dialog window.

Dialog Box

new

Overview

The new function creates a new RadDialog object and returns a pointer to the newly created object. The RadDialog is one of the class key words accepted by the qt new: function. There can be many RadDialog objects, but only one RadDialog window can be displayed as a time.

The RadDialog window responds to only one event - the Close event. The RadDialog manager, if present, is invoked when the Close event occurs. If the RadDialog manager Lambda contains a member Lambda named "close", then the close Lambda will be invoked when the Close event occurs; otherwise the RadDialog manager Lambda itself will be invoked when the Close event occurs. For example:

        ;; The RadDialog manager may contain a close member and it may return a value to the calling program.
        (lambda (...) (defun close(...) (writeln "If I exist, I will be invoked on a Close event") (qt radDialogPtr done: 0)))
        ;; The RadDialog manager may contain no close member and it may return a value to the calling program.
        (lambda (...) (writeln "There is no close member, So I will be invoked on a Close event") (qt radDialogPtr done: 1)))
        ;; Display the dialog window and wait for the user to press the Okay or the Sick button.
        (setq result (qt radDialog exec:))  ;; Display the dialog window and return the code for the button pressed.
        

 

Syntax

(qt new: RadDialog: dialogLabel dialogMgr)

Arguments

dialogLabelA string forming the dialog window title.
dialogMgr(Optional)The dialog window manager Lambda to manage the RadDialog object.
ReturnsAlways returns a pointer to the newly created RadDialog object.

 

Example1

        ;; Build a dialog window with an Okay button and a Sick button.
        (setq radDialog (qt new: RadDialog: "Dialog Window with an Okay Button"))
        (setq okayButton (qt new: RadPushButton: "Okay" (lambda(...) (writeln "You pressed Okay") (qt radDialog done: 0))))
        (setq sickButton (qt new: RadPushButton: "Sick" (lambda(...) (writeln "You pressed Sick") (qt radDialog done: 1))))
        (setq mainLayout (qt new: RadVBoxLayout:))
        (qt mainLayout addWidget: okayButton)
        (qt mainLayout addWidget: sickButton)
        (qt radDialog setLayout: mainLayout)
        ;; Display the dialog window and wait for the user to press the Okay or the Sick button.
        (setq result (qt radDialog exec:))  ;; Display the dialog window and return the code for the button pressed.
        

accept

Overview

The accept function hides a RadDialog object and sets the RadDialog state to "Accepted".

 

Syntax

(qt RadDialogPtr accept:)

Arguments

ReturnsAlways returns #void.

 

Example1

        (setq radDialogPtr (qt new: RadDialog: "BLUE" BlueDialogMgr))   ;; Create a RadDialog object.
        (qt radDialogPtr accept:)                                       ;; Hide the RadDialog object for later display.
        

delete

Overview

The delete function destroys a RadDialog object and returns a null pointer.

 

Syntax

(qt delete: RadDialogPtr)

Arguments

radDialogPtrThe pointer to the RadDialog object to be destroyed.
ReturnsAlways returns a null pointer.

 

Example1

        (setq radDialogPtr (qt new: RadDialog: "BLUE" BlueDialogMgr))   ;; Create a RadDialog object.
        (setq radDialogPtr (qt delete: radDialogPtr))                   ;; Destroy the RadDialog object.
        

done

Overview

The done function hides a RadDialog object and returns the specified Integer value argument.

 

Syntax

(qt RadDialogPtr done: retValue)

Arguments

retValueThe Integer value to be returned.
ReturnsAlways returns the Integer value argument.

 

Example1

        (setq radDialogPtr (qt new: RadDialog: "BLUE" BlueDialogMgr))   ;; Create a RadDialog object.
         (qt radDialogPtr done: 1)                                      ;; Hide the RadDialog object and return 1.
        

exec

Overview

The exec function executes a RadDialog object modally and returns an Integer return value when the dialog window closes (see the "done" method).

 

Syntax

(qt RadDialogPtr exec:)

Arguments

ReturnsAlways returns an Integer return value.

 

Example1

        (setq radDialogPtr (qt new: RadDialog: "BLUE" BlueDialogMgr))   ;; Create a RadDialog object.
        (setq return (qt radDialogPtr exec:))                           ;; Excute the RadDialog window modally.
        

reject

Overview

The reject function hides a RadDialog object and sets the dialog state to "Reject".

 

Syntax

(qt RadDialogPtr reject:)

Arguments

ReturnsAlways returns a #void value.

 

Example1

        (setq radDialogPtr (qt new: RadDialog: "BLUE" BlueDialogMgr))   ;; Create a RadDialog object.
        (qt radDialogPtr reject:)                                       ;; Hide the RadDialog object for later display.
        

resize

Overview

The resize function resizes a RadDialog window to the specified width and height.

 

Syntax

(qt RadDialogPtr resize: width height)

Arguments

ReturnsAlways returns a #void value.

 

Example1

        (setq radDialogPtr (qt new: RadDialog: "BLUE" BlueDialogMgr))   ;; Create a RadDialog object.
        (qt radDialogPtr resize: 300 200)                               ;; Resize the RadDialog window to the specified width and height.
        

setLayout

Overview

The setLayout function populates the RadDialog window's main layout object. The main layout object must contain the controls and sublayouts which populate the dialog window. RadWidgets cannot be directly attached to a dialog window. RadWidgets must be first attached to the main layout and then the main layout may be attached to the dialog window.

 

Syntax

(qt RadDialogPtr setLayout: RadVBoxLayoutPtr)

Arguments

ReturnsAlways returns a #void value.

 

Example1

        (setq radDialogPtr (qt new: RadDialog: "BLUE" BlueDialogMgr))   ;; Create a RadDialog object.
        (qt radDialogPtr setLayout: RadVBoxLayoutPtr)                   ;; Set the RadDialog main layout to a vertical layout box.
        

 

Syntax

(qt RadDialogPtr setLayout: RadHBoxLayoutPtr)

Arguments

ReturnsAlways returns a #void value.

 

Example1

        (setq radDialogPtr (qt new: RadDialog: "BLUE" BlueDialogMgr))   ;; Create a RadDialog object.
        (qt radDialogPtr setLayout: RadHBoxLayoutPtr)                   ;; Set the RadDialog main layout to a horizontal layout box.
        

setManager

Overview

The setManager sets the RadDialog window's main event manager.

The RadDialog window responds to only one event - the Close event. The RadDialog manager, if present, is invoked when the Close event occurs. If the RadDialog manager Lambda contains a member Lambda named "close", then the close Lambda will be invoked when the Close event occurs; otherwise the RadDialog manager Lambda itself will be invoked when the Close event occurs. For example:

        ;; The RadDialog manager may contain a close member and it may return a value to the calling program.
        (lambda (...) (defun close(...) (writeln "If I exist, I will be invoked on a Close event") (qt radDialogPtr done: 0)))
        ;; The RadDialog manager may contain no close member and it may return a value to the calling program.
        (lambda (...) (writeln "There is no close member, So I will be invoked on a Close event") (qt radDialogPtr done: 1)))
        ;; Display the dialog window and wait for the user to press the Okay or the Sick button.
        (setq result (qt radDialog exec:))  ;; Display the dialog window and return the code for the button pressed.
        

 

Syntax

(qt RadDialogPtr setManager: dialogMgr)

Arguments

dialogMgrThe dialog window main event manager.
ReturnsAlways returns a #void value.

 

Example1

        (setq radDialogPtr (qt new: RadDialog: "BLUE"))   ;; Create a RadDialog object.
        (qt radDialogPtr setManager:  BlueDialogMgr)      ;; Set the RadDialog main event manager.
        

setTitle

Overview

The setTitle sets the RadDialog window's main title.

 

Syntax

(qt RadDialogPtr setTitle: dialogWindowTitle)

Arguments

dialogWindowTitleThe dialog window main title.
ReturnsAlways returns a #void value.

 

Example1

        (setq radDialogPtr (qt new: RadDialog: "BLUE"))   ;; Create a RadDialog object.
        (qt radDialogPtr setTitle:  "Changed Title")      ;; Set the RadDialog main window title.