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.
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.
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
dialogLabel | A string forming the dialog window title. |
dialogMgr | (Optional)The dialog window manager Lambda to manage the RadDialog object. |
Returns | Always 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.
Overview
The accept function hides a RadDialog object and sets the RadDialog state to "Accepted".
Syntax
(qt RadDialogPtr accept:)
Arguments
Returns | Always returns #void. |
Example1
(setq radDialogPtr (qt new: RadDialog: "BLUE" BlueDialogMgr)) ;; Create a RadDialog object. (qt radDialogPtr accept:) ;; Hide the RadDialog object for later display.
Overview
The delete function destroys a RadDialog object and returns a null pointer.
Syntax
(qt delete: RadDialogPtr)
Arguments
radDialogPtr | The pointer to the RadDialog object to be destroyed. |
Returns | Always 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.
Overview
The done function hides a RadDialog object and returns the specified Integer value argument.
Syntax
(qt RadDialogPtr done: retValue)
Arguments
retValue | The Integer value to be returned. |
Returns | Always 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.
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
Returns | Always 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.
Overview
The reject function hides a RadDialog object and sets the dialog state to "Reject".
Syntax
(qt RadDialogPtr reject:)
Arguments
Returns | Always 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.
Overview
The resize function resizes a RadDialog window to the specified width and height.
Syntax
(qt RadDialogPtr resize: width height)
Arguments
Returns | Always 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.
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
Returns | Always 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
Returns | Always 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.
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
dialogMgr | The dialog window main event manager. |
Returns | Always 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.
Overview
The setTitle sets the RadDialog window's main title.
Syntax
(qt RadDialogPtr setTitle: dialogWindowTitle)
Arguments
dialogWindowTitle | The dialog window main title. |
Returns | Always 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.