Contents Up Previous Next

wxWizard

wxWizard is the central class for implementing 'wizard-like' dialogs. These dialogs are mostly familiar to Windows users and are nothing else but a sequence of 'pages' each of them displayed inside a dialog which has the buttons to pas to the next (and previous) pages.

The wizards are typically used to decompose a complex dialog into several simple steps and are mainly useful to the novice users, hence it is important to keep them as simple as possible.

To show a wizard dialog, you must first create an object of wxWizard class using Create function. Then you should add all pages you want the wizard to show and call RunWizard. Finally, don't forget to call wizard->Destroy().

Derived from

wxDialog
wxPanel
wxWindow
wxEvtHandler
wxObject

Include files

<wx/wizard.h>

Event table macros

To process input from a wizard dialog, use these event handler macros to direct input to member functions that take a wxWizardEvent argument. For some events, Veto() can be called to prevent the event from happening.

EVT_WIZARD_PAGE_CHANGED(id, func) The page has been just changed (this event can not be vetoed).
EVT_WIZARD_PAGE_CHANGING(id, func) The page is being changed (this event can be vetoed).
EVT_WIZARD_CANCEL(id, func) The user attempted to cancel the wizard (this event may also be vetoed).
See also

wxWizardEvent, wxWizardPage, wxWizard sample

Members

wxWizard::Create
wxWizard::RunWizard
wxWizard::GetCurrentPage
wxWizard::GetPageSize
wxWizard::SetPageSize


wxWizard::Create

static wxWizard* Create(wxWindow* parent, int id = -1, const wxString& title = wxEmptyString, const wxBitmap& bitmap = wxNullBitmap, const wxPoint& pos = wxDefaultPosition)

Creates the wizard dialog. The returned pointer should not be deleted directly, you should rather call Destroy() on it and wxWindows will delete it itself.

Notice that unlike almost all other wxWindows classes, there is no size parameter in wxWizard constructor because the wizard will have a predefined default size by default. If you want to change this, you should use the SetPageSize function.

Parameters

parent

id

title

bitmap

pos


wxWizard::RunWizard

bool RunWizard(wxWizardPage* firstPage)

Executes the wizard starting from the given page, returns TRUE if it was successfully finished or FALSE if user cancelled it. The firstPage can not be NULL.


wxWizard::GetCurrentPage

wxWizardPage* GetCurrentPage() const

Get the current page while the wizard is running. NULL is returned if RunWizard() is not being executed now.


wxWizard::GetPageSize

wxSize GetPageSize() const

Returns the size available for the pages.


wxWizard::SetPageSize

void SetPageSize(const wxSize& sizePage)

Sets the minimal size to be made available for the wizard pages. The wizard will take into account the size of the bitmap (if any) itself. Also, the wizard will never be smaller than the default size.

The recommended way to use this function is to layout all wizard pages using the sizers (even though the wizard is not resizeable) and then use wxSizer::CalcMin in a loop to calculate the maximum of minimal sizes of the pages and pass it to SetPageSize().