Contents Up Previous Next

Dialog box overview

Function group/class: DialogBox/wxDialogBox

A dialog box is similar to a panel, in that it is a window which can be used for placing panel items, with the following exceptions:

  1. A surrounding frame is implicitly created.
  2. Extra functionality is automatically given to the dialog box, such as tabbing between items (currently Windows only).
  3. If the dialog box is modal, the calling program is blocked until the dialog box is dismissed.

Under XView, some panel items may display incorrectly in a modal dialog, and two modal dialogs may not be open simultaneously. This can be corrected using a wxWindows patch.

Under implementations that permit it, Dialog box inherits from Canvas via Panel, and has a Panel DC that the application can draw on.

The panel device context associated with Dialog box behaves slightly differently than for a panel or canvas: drawing to it requires enclosing code in dc-begin-drawing, dc-end-drawing calls. This is because under Windows, dialog box device contexts are not 'retained' and settings would be lost if the device context were retrieved and released for each drawing operations.

See Miscellaneous for convenience dialog functions which avoid the need to create a dialog box and individual items.

The following callbacks are valid for the dialog box class:

OnCommand
Called with a panel identifier, an item identifier and a command event identifier when a command event is received by a panel item that does not have an associated callback. If you have created a panel or dialog box from a resource, you will need to intercept OnCommand.
OnClose
The function is called with the window identifier. If the callback returns 1 and the function was called by the window manager, the window is automatically deleted. A return value of 0 forbids automatic deletion.
OnEvent
Called with a dialog box identifier and a mouse event identifier. This can only be guaranteed only when the dialog box is in user edit mode (to be implemented).
OnPaint
Called with a dialog box identifier when the dialog box receives a repaint event from the window manager.
OnSize
The function is called with the dialog box identifier, width and height.

See also Panel and Window for inherited member functions.