Contents Up Previous Next

wxDialogBox: wxPanel

Overview

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.

See also wxPanel and wxWindow for inherited member functions.

wxDialogBox::wxDialogBox
wxDialogBox::~wxDialogBox
wxDialogBox::Centre
wxDialogBox::Create
wxDialogBox::GetTitle
wxDialogBox::Iconize
wxDialogBox::Iconized
wxDialogBox::IsModal
wxDialogBox::OnCharHook
wxDialogBox::SetModal
wxDialogBox::SetTitle
wxDialogBox::Show


wxDialogBox::wxDialogBox

void wxDialogBox(wxWindow *parent, char *title, Bool modal=FALSE,
int x=300, int y=300, int width=500, int height=500,
long style = wxDEFAULT_DIALOG_STYLE,
char *name = "dialogBox")

Constructor. The parent of the dialog box can be NULL, a frame or a dialog box.

If title is non-NULL, it is placed on the window frame.

If modal is TRUE, the dialog box will wait to be dismissed (using Show(FALSE)) before returning control to the calling program.

The style parameter may be a combination of the following, using the bitwise 'or' operator:

wxCAPTION Puts a caption on the dialog box (Motif only).
wxDEFAULT_DIALOG_STYLE Equivalent to a combination of wxCAPTION, wxSYSTEM_MENU and wxTHICK_FRAME
wxRESIZE_BORDER Display a resizeable frame around the window (Motif only).
wxSYSTEM_MENU Display a system menu (Motif only).
wxTHICK_FRAME Display a thick frame around the window (Motif only).
wxUSER_COLOURS Under Windows, overrides standard control processing to allow setting of the dialog box background colour.
wxVSCROLL Give the dialog box a vertical scrollbar (XView only).

Note that none take effect under Windows, only wxVSCROLL works under XView, and for Motif the MWM (the Motif Window Manager) should be running for any to work.

The name parameter is used to associate a name with the window, allowing the application user to set Motif resource values for individual dialog boxes.


wxDialogBox::~wxDialogBox

void ~wxDialogBox(void)

Destructor. Deletes any panel items before deleting the physical window.


wxDialogBox::Centre

void Centre(int direction = wxBOTH)

Centres the dialog box on the display. The parameter may be wxHORIZONTAL, wxVERTICAL or wxBOTH.


wxDialogBox::Create

void Create(wxFrame *parent, char *title, Bool modal=FALSE,
int x=300, int y=300, int width=500, int height=500,
long style = = wxDEFAULT_DIALOG_STYLE,
char *name = "dialogBox")

Used for two-step dialog box construction. See wxDialogBox::wxDialogBox for details.


wxDialogBox::GetTitle

char * GetTitle(void)

Gets a temporary pointer to the title of the dialog box.


wxDialogBox::Iconize

void Iconize(Bool iconize)

If TRUE, iconizes the dialog box; if FALSE, shows and restores it. Note that in Windows, iconization has no effect since dialog boxes cannot be iconized. However, applications may need to explicitly restore dialog boxes under XView and Motif which have user-iconizable frames, and under Windows calling Iconize(FALSE) will bring the window to the front, as does Show(TRUE).


wxDialogBox::Iconized

Bool Iconized(void)

Returns TRUE if the dialog box is iconized. Always returns FALSE under Windows for the reasons given above.


wxDialogBox::IsModal

Bool IsModal(void)

Returns TRUE if the dialog box is modal, FALSE otherwise.


wxDialogBox::OnCharHook

Bool OnCharHook(wxKeyEvent& ch)

This member is called (under Windows only) to allow the window to intercept keyboard events before they are processed by child windows. The window receives this event from the default wxApp::OnCharHook member function if the window (frame or dialog box) is active. The function should returns TRUE to indicate the character has been processed, or FALSE to allow default processing. The default implementation for wxWindow returns FALSE, but the wxDialogBox implementation checks for WXK_ESCAPE, calls OnClose and if this returns TRUE, deletes the dialog box.

See also wxKeyEvent, wxEvtHandler::OnChar, wxEvtHandler::OnCharHook.


wxDialogBox::SetModal

void SetModal(Bool flag)

Allows the programmer to specify whether the dialog box is modal (wxDialogBox::Show blocks control until the dialog is hidden) or modeless (control returns immediately).


wxDialogBox::SetTitle

void SetTitle(char * title)

Sets the title of the dialog box.


wxDialogBox::Show

Bool Show(Bool show)

If show is TRUE, the dialog box is shown and brought to the front; otherwise the box is hidden. If show is FALSE and the dialog is modal, control is returned to the calling program.