Wizard

Type: Wizard

Extends Window

Script class for Wizard scripts.

A global 'wizard' object is provided to access these functions.

wizard.on("next", function() { print("Next Clicked"); });

Properties

PropertyDescription
Since version 4.04.23, view IDs may be accessed directly instead of through findViewByID. Assignment to an unspecified ID shall set the script id of the view being assigned.
isEditMode Determine if the wizard is running in edit mode.
isRunMode Determine if the wizard is running in run mode.

Methods

MethodDescription
findViewByID(id) Searches child views for the first one with a script ID that matches 'id' (set via view properties). Returns a reference to the view, or 'null' if nothing found.
findViewByTitle(title) Searches child views for the first one with a title that matches 'title'. Returns a reference to the view, or 'null' if nothing found.
setRefreshTimer(callback) Sets a callback function to be called periodically, dependent upon the user interface update rate setting in general preferences.

Typically around 25Hz.

To cancel the timer, call this function with a 'null' argument.

back()

Go to the previous step.

Returns true if the previous step was found.

The wizard will emit the "step" event after the step is changed. The event is deferred via the application event loop.

This function will only work if the previous step is defined in the predefined step list

Scripts may implement the on("back", ()=>{...}) event handler for dynamic control over step ordering.

See gotoStep and vetoEventfor more information.

cancel()

Cancel the wizard.

close([exit_code])

Close the wizard dialog.

If exit_code is provided, the wizard shall be closed with the given exit code. Otherwise the wizard shall be closed with the default exit code (OK, 5100).

codes include:

  • OK - 5100
  • CANCEL - 5101
  • APPLY - 5102
  • YES - 5103
  • NO - 5104
  • HELP - 5009

The exit code may be specified as an integer or string.

wizard.close("cancel");

finish()

Finish the wizard.

getStep() Get the current step. Returns the script ID of the current step.
gotoStep(id) Go to the step given by the script ID passed in.

Returns true if the step was found.

The wizard will emit the "step" event after the step is changed. The event is deferred via the application event loop.

next()

Go to the next step.

Returns true if the next step was found.

The wizard will emit the "step" event after the step is changed. The event is deferred via the application event loop.

This function will only work if the next step is defined in the predefined step list

Scripts may implement the on("next", ()=>{...}) event handler for dynamic control over step ordering.

See gotoStep and vetoEventfor more information.

on(eventName, callback) Adds an event listener for the given event name. e.g. wizard.on("next", function() { ... });
removeAllListeners([eventName]) Removes all event listeners for the given event name. If the event name is not given then all listeners for all events are removed.
removeListener(eventName, callback) Removes an event listener for the given event name. e.g. let callback = function() { ... }; wizard.on("next", callback); view.removeListener("next", callback);
setEnableBack([enable])

Enable or disable the back button.

When called with no arguments, the back button shall be enabled if the current step has a 'back' item in the predefined step list.

setEnableCancel([enable])

Enable or disable the cancel button.

When called with no arguments, the cancel button shall be enabled by default.

setEnableCustomButton([enable])

Enable or disable the custom button.

When called with no arguments, the custom button shall be enabled by default.

setEnableFinish([enable])

Enable or disable the finish button.

When called with no arguments, the finish button shall be enabled if the current step does not have a 'next' item in the predefined step list.

setEnableHelp([enable])

Enable or disable the help button.

When called with no arguments, the help button shall be enabled if the current step (or the wizard) has help HTML or URL defined.

setEnableNext([enable])

Enable or disable the next button.

When called with no arguments, the next button shall be enabled if the current step has a 'next' item in the predefined step list.

showHelpHtml(html)

Show the given HTML in the help panel.

showHelpURL(url)

Close the help panel (if open) and launch the URL in the system default web browser.

vetoEvent([veto])

Prevent the current event from being processed.

When called with no arguments, the current event shall be prevented from being processed.

When called with a boolean argument, the current event shall be prevented from being processed if the argument is true.

Events

EventDescription
back

Event raised when back button was clicked.

wizard.on("back", function() { ... });

Calling vetoEvent() during this event will prevent the wizard from taking the default 'back' action.

See also setEnableBack.

See also gotoStep for dyamic control of step ordering.

cancel

Event raised when cancel button was clicked.

wizard.on("cancel", function() { ... });

Calling vetoEvent() during this event will prevent the wizard from taking the default 'cancel' action.

See also setEnableCancel.

close(code)

Event raised when the wizard is closing.

code is a wxWidgets ID (e.g. wxID_CANCEL).

wizard.on("close", function(code) { ... });

Calling vetoEvent() during this event will prevent the wizard from closing the wizard.

custom

Event raised when custom button was clicked.

wizard.on("custom", function() { ... });

Calling vetoEvent() during this event will prevent the wizard from taking the default 'custom' action.

See also setEnableCustom.

finish

Event raised when finish button was clicked.

wizard.on("finish", function() { ... });

Calling vetoEvent() during this event will prevent the wizard from taking the default 'finish' action.

See also setEnableFinish.

help

Event raised when help button was clicked.

wizard.on("help", function() { ... });

Calling vetoEvent() during this event will prevent the wizard from taking the default 'help' action.

See also setEnableHelp.

next

Event raised when next button was clicked.

wizard.on("next", function() { ... });

Calling vetoEvent() during this event will prevent the wizard from taking the default 'next' action.

See also setEnableNext.

See also gotoStep for dyamic control of step ordering.

step

Event raised when the current step has changed.

wizard.on("step", function() { ... });

The step event shall be emitted shortly after the wizard starts if any steps were defined.