#include <WDialog>
Inherits Wt::WCompositeWidget.
Inherited by Wt::WMessageBox.
Inheritance diagram for Wt::WDialog:

Public Types | |
| Rejected | |
| Dialog closed with reject(). | |
| Accepted | |
| Dialog closed with accept(). | |
| enum | DialogCode { Rejected, Accepted } |
| The result of a modal dialog execution. More... | |
Public Member Functions | |
| WDialog (const WString &caption=WString()) | |
| Construct a WDialog with a given caption. | |
| ~WDialog () | |
| Destruct a WDialog. | |
| void | setCaption (const WString &caption) |
| Set the dialog caption. | |
| const WString & | caption () const |
| Get the dialog caption. | |
| WContainerWidget * | contents () const |
| Get the dialog contents container. | |
| DialogCode | exec () |
| Execute the dialog in a recursive event loop. | |
| virtual void | done (DialogCode r) |
| Stop a recursive event loop. | |
| virtual void | accept () |
| Stop a recursive event loop with result is Accepted. | |
| virtual void | reject () |
| Stop a recursive event loop with result is Rejected. | |
| DialogCode | result () const |
| Get the result that was set for this dialog. | |
Public Attributes | |
| Signal< DialogCode > | finished |
| Signal emitted when the recursive event loop is ended. | |
A modal window blocks the user interface, and does not allow the user to interact with any other part of the user interface until the dialog is closed.
There are two distinct ways for using a WDialog window.
The easiest way is using the exec() method: after creating a WDialog window, call the exec() method which blocks until the dialog window is closed, and returns the dialog result. Typically, an OK button will be connected to the accept() slot, and a Cancel button to the reject() slot. This solution has the drawback that it is not scalable to many concurrent sessions, since every recursive event loop (which is running durring the exec() method) locks a thread. Therefore it is only suitable for software to be deployed on an intranet.
A second way is by treating the WDialog as another widget. In this case, the WDialog is created with the proper content, and for example an OK button is connected to a method which deletes the dialog.
Widgets may be added to the dialog, by adding to the contents() ContainerWidget.
Only one WDialog window may exist at any time in a single application. An attempt to instantiate a second dialog will result in an exception that terminates the session.
Construct a WDialog with a given caption.
Only a single Dialog may be constructed at any time. Unlike other widgets, a dialog does not need to be added to a container widget.
| void Wt::WDialog::accept | ( | ) | [virtual] |
| WContainerWidget* Wt::WDialog::contents | ( | ) | const [inline] |
Get the dialog contents container.
Content to the dialog window may be added to this container widget.
| void Wt::WDialog::done | ( | DialogCode | r | ) | [virtual] |
Stop a recursive event loop.
Sets the dialog result, and ends a recursive event loop that was started using the exec() method.
| WDialog::DialogCode Wt::WDialog::exec | ( | ) |
Execute the dialog in a recursive event loop.
Executes the dialog. This blocks the current thread of execution until one of done(Dialog), accept() or reject() is called.
Warning: using exec() does not scale to many concurrent sessions, since the thread is locked.
| void Wt::WDialog::reject | ( | ) | [virtual] |
| DialogCode Wt::WDialog::result | ( | ) | const [inline] |
Signal emitted when the recursive event loop is ended.
1.4.7