The wizard is supposed to simplify a configuration progress which requires several inputs and decisions by the user.
These can be settings and usage terms on first startup or an installation process as you might know from desktop applications.
The callback function will be called each time the user changes the wizard page.
The functions gets the current wizard layout and the page index (starting from 1) to identify the current progress.
Note: This function is a premium feature. Please consider subscribing to Premium to use this feature and support DroidScript in its further development.
Page Initialisation
On the very first call the page index is 0 which means 'initialisation'.
Then you have to create and add all wizard pages to the passed (frame) layout.
In case the user cancels the wizard the index is -1.
Example - Demo
function OnStart()
{
var theme = app.CreateTheme( "light" );
app.SetTheme( theme );
wiz = app.CreateWizard( "My Wizard", 0.7, 0.7, OnWizard );
wiz.Show();
}
function OnWizard( lay, page )
{
switch( page ) {
case 0:
wizTxt = app.CreateText( "", -1, -1, "MultiLine" );
wizTxt.SetTextSize( 19 );
lay.AddChild( wizTxt );
wizFlag = app.CreateText( "[fa-flag-checkered]", -1, -1, "FontAwesome" );
wizFlag.SetMargins( 0, 0.05, 0, 0 );
wizFlag.SetTextSize( 64 );
wizFlag.Gone();
lay.AddChild( wizFlag );
break;
case 1:
var msg = "This is the first page of your wizard";
wizTxt.SetText( msg );
break;
case 2:
var msg = "You can put any controls you like here, including"
+ " a webview and have as many pages as you like";
wizTxt.SetText( msg );
wizFlag.Gone();
break;
case 3:
wizTxt.SetText( "Wizard complete!" );
wizFlag.Show();
wiz.Finish();
break;
case 4:
wiz.Dismiss();
app.ShowPopup( "Wizard finished" );
break;
case -1:
app.ShowPopup( "Wizard cancelled" );
}
}
from native import app
def OnStart():
global wiz
theme = app.CreateTheme("light")
app.SetTheme(theme)
wiz = app.CreateWizard("My Wizard", 0.7, 0.7, OnWizard)
wiz.Show()
def OnWizard(lay, page):
if page == 0:
wizTxt = app.CreateText("", -1, -1, "MultiLine")
wizTxt.SetTextSize(19)
lay.AddChild(wizTxt)
wizFlag = app.CreateText("[fa-flag-checkered]", -1, -1, "FontAwesome")
wizFlag.SetMargins(0, 0.05, 0, 0)
wizFlag.SetTextSize(64)
wizFlag.Gone()
lay.AddChild(wizFlag)
elif page == 1:
msg = "This is the first page of your wizard"
wizTxt.SetText(msg)
elif page == 2:
msg = "You can put any controls you like here, including a webview and have as many pages as you like"
wizTxt.SetText(msg)
wizFlag.Gone()
elif page == 3:
wizTxt.SetText("Wizard complete!")
wizFlag.Show()
wiz.Finish()
elif page == 4:
wiz.Dismiss()
app.ShowPopup("Wizard finished")
elif page == -1:
app.ShowPopup("Wizard cancelled")
Properties
The following properties are available on the Wizard object:
Methods
The following methods are available on the Wizard object:
all types
String
Number: fraction (0..1)
String: comma “,” separated: “AutoCancel” or “NoCancel”, “NoTitle”, “NoFocus”, “NoDim”, “NoKeys”, “TouchModal”, “NoTouch”
Object: {
command:
args }
wiz.Batch
Batch method calls to be able to set all object's properties at once.
Note that you need to specify each parameter (use “” or null to leave some out)
Inherited methods can be called by appending an underscore to the function name (ie. txt.Batch({ SetBackColor_: [“red”] })
wiz.data
An object for saving individual extra properties.
wiz.Dismiss
Hide the control and remove it from the screen.
wiz.Finish
Indicate that the Wizard is going to finish on the next page.
wiz.GetButtons
Returns the list of the three control buttons at the bottom of the wizard.
wiz.GetDialogReturns the
dialog object of the wizard.
wiz.GetLayoutReturn s the content
layout object of the wizard.
wiz.GetType
Returns the control class name.
wiz.Hide
Hide the control but keep the layout space free.
wiz.IsVisible
Returns whether the control is currently visible to the user, ignoring overlaying controls.
wiz.Show
Set the visibility of the control to “Show”.