## 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 pass 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 either the non default constructor or a default one followed by call to 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).
EVT_WIZARD_HELP(id, func) | The wizard help button was pressed.
EVT_WIZARD_FINISHED(id, func) | The wizard finished button was pressed.

Extended styles

Use the wxWindow::SetExtraStyle function to set the following style. You will need to use two-step construction (use the default constructor, call SetExtraStyle, then call Create).

wxWIZARD_EX_HELPBUTTON | Shows a Help button using wxID_HELP.

See also wxDialog for other extended styles.

See also

wxWizardEvent, wxWizardPage, wxWizard sample

Members

wxWizard::wxWizard
wxWizard::Create
wxWizard::FitToPage
wxWizard::GetCurrentPage
wxWizard::GetPageSize
wxWizard::HasNextPage
wxWizard::HasPrevPage
wxWizard::RunWizard
wxWizard::SetPageSize

### wxWizard::wxWizard

wxWizard()

Default constructor. Use this if you wish to derive from wxWizard and then call Create, for example if you wish to set an extra style with wxWindow::SetExtraStyle between the two calls.

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

Constructor which really creates the wizard -- if you use this constructor, you shouldn't call Create.

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

The parent window, may be NULL.

id

The id of the dialog, will usually be just -1.

title

The title of the dialog.

bitmap

The default bitmap used in the left side of the wizard. See also GetBitmap.

pos

The position of the dialog, it will be centered on the screen by default.

### wxWizard::Create

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

Creates the wizard dialog. Must be called if the default constructor had been used to create the object.

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

The parent window, may be NULL.

id

The id of the dialog, will usually be just -1.

title

The title of the dialog.

bitmap

The default bitmap used in the left side of the wizard. See also GetBitmap.

pos

The position of the dialog, it will be centered on the screen by default.

### wxWizard::FitToPage

void FitToPage(const wxWizardPage* firstPage)

Sets the page size to be big enough for all the pages accessible via the given firstPage, i.e. this page, its next page and so on.

This method may be called more than once and it will only change the page size if the size required by the new page is bigger than the previously set one. This is useful if the decision about which pages to show is taken during the run-time as in this case, the wizard won't be able to get to all pages starting from a single one and you should call Fit separately for the others.

### 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::HasNextPage

virtual bool HasNextPage(wxWizardPage *page)

Return `TRUE` if this page is not the last one in the wizard. The base class version implements this by calling page->GetNext but this could be undesirable if, for example, the pages are created on demand only.

See also

HasPrevPage

### wxWizard::HasPrevPage

virtual bool HasPrevPage(wxWizardPage *page)

Return `TRUE` if this page is not the last one in the wizard. The base class version implements this by calling page->GetPrev but this could be undesirable if, for example, the pages are created on demand only.

See also

HasNextPage

### 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::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().