XUL:wizard
From MDC
« XUL Reference home [ Examples | Attributes | Properties | Methods | Related ]
This element is used to construct a step-by-step wizard found in some applications to guide users through a task. It is used for a window with several steps contained on several pages. This element provides the header and buttons along the bottom, and also handles navigation between the pages. Each page should be constructed using a wizardpage. The pages are displayed in the order that they are placed in the wizard, unless you use the next and pageid attributes on the pages to change the sequence. The wizard will rendered in a manner suitable for the user's selected theme and platform. In newer versions of Mozilla, a statusbar may be placed directly inside the wizard element which will be shared among all pages.
More information is available in the XUL tutorial.
- Attributes
- firstpage, lastpage, onextra1, onextra2, onwizardback, onwizardcancel, onwizardfinish, onwizardnext, pagestep, title, windowtype
- Properties
- canAdvance, canRewind, currentPage, onFirstPage, onLastPage, pageCount, pageIndex, pageStep, title, wizardPages
[edit] Examples
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<wizard id="theWizard" title="Secret Code Wizard"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script>
function checkCode(){
document.getElementById('theWizard').canAdvance = (document.getElementById('secretCode').value == "cabbage");
}
</script>
<wizardpage onpageshow="checkCode();">
<label value="Enter the secret code:"/>
<textbox id="secretCode" onkeyup="checkCode();"/>
</wizardpage>
<wizardpage>
<label value="That is the correct secret code."/>
</wizardpage>
</wizard>
[edit] Attributes
|
Inherited from XUL element |
- activetitlebarcolor New in Firefox 3
- Type: color string
- Specify background color of the window's titlebar when it is active (foreground). Moreover this hides separator between titlebar and window contents. This affects only on Mac OS X.
- firstpage
- Type: boolean
-
trueif the wizard is on the first page.
- inactivetitlebarcolor New in Firefox 3
- Type: color string
- Specify background color of the window's titlebar when it is inactive (background). Moreover this hides separator between titlebar and window contents. This affects only on Mac OS X.
- lastpage
- Type: boolean
-
Trueif the wizard is on the last page.
- onextra1
- Type: script code
- This should be set to code which is called when the user presses the extra1 button.
- onextra2
- Type: script code
- This should be set to code which is called when the user presses the extra2 button.
- onwizardback
- Type: script code
- This should be set to code which is called when the user presses the Back button. Return
trueto allow the previous page to be displayed andfalseto disallow moving back a page. Use the canRewind property to indicate to the user (by disabling the Back button) that they cannot go back a page.
- onwizardcancel
- Type: script code
- This should be set to code which is called when the user presses the Cancel button. Return
trueto allow the wizard to be cancelled, and close the wizard, or returnfalseto prevent the wizard from being cancelled.
- onwizardfinish
- Type: script code
- This should be set to code which is called when the user presses the Finish button, which would appear in place of the Next button on the last page of the wizard. Return
trueto allow the wizard to be closed, accepting any values entered on the pages, or returnfalseto prevent the wizard from being closed. Use the canAdvance property to indicate to the user (by disabling the Finish button) that they cannot end the wizard.
- onwizardnext
- Type: script code
- This should be set to code which is called when the user presses the Next button. Return
trueto allow the next page to be displayed andfalseto disallow moving to the next page. Use the canAdvance property to indicate to the user (by disabling the Next button) that they cannot go to the next page.
- pagestep
- Type: integer
- The index of the current page.
- title
- Type: string
- The text to appear in the title bar of the window.
- windowtype
- Type: string
- Set to a string which can be used to identify the type of window. This might be used, for example, to distinguish between a browser window and an editor window. Some of Mozilla's window handling functions use this attribute to group windows of the same type together.
[edit] Properties
|
Inherited from XUL element Inherited from DOM element |
- canAdvance
- Type: boolean
- This property is set to
trueif the user can press the Next button to go to the next page. If this property isfalse, the user cannot navigate to the next page. Set this property totrueto indicate that the user can go to the next page. Set tofalseto disallow moving to the next page. This has the effect of enabling or disabling the Next button, or, on the last page of the wizard, the Finish button.
- canRewind
- Type: boolean
- This property is set to
trueif the user can press the Back button to go to the previous page. If this property isfalse, the user cannot navigate to the previous page. Set this property totrueto indicate that the user can go back a page. Set tofalseto disallow moving to the previous page. This has the effect of enabling or disabling the Back button.
- currentPage
- Type: wizardpage element
- This property returns the wizardpage element that is currently displayed. You can modify this value to change the current page.
- onFirstPage
- Type: boolean
- This property is set to
trueif the user is on the first page, which may or may not be the first index.
- onLastPage
- Type: boolean
- This property is set to
trueif the user is on the last page of the wizard.
- pageCount
- Type: integer
- This property holds the number of pages in the wizard.
- pageIndex
- Type: integer
- This property returns the index of the currently selected page. You can change the selected page by modifying this property.
- pageStep
- Type: integer
- This property returns the number of pages that the user has navigated through so far, meaning that the user would press the Back button this many times to go back to the beginning. This property is different than pageIndex, because pages are not necessarily navigated in order.
- title
- Type: string
- The title that appears at the top of the wizard. This is overridden by the label attribute on the individual pages.
- wizardPages
- Type: DOM NodeList of wizardpage elements
- This property holds the list of wizardpage elements in the wizard.
[edit] Methods
|
Inherited from XUL element Inherited from DOM element |
- advance( pageID )
- Return type: no return value
- Call this method to go to the next page. This is equivalent to pressing the Next button. The canAdvance property must be set to
truefor the page to be changed. The code in the onwizardnext attribute is called before the page is changed. The pageID argument allows you to specify the index of the page to which to jump. Supplynullas the argument to go to the next page in the sequence.
- cancel()
- Return type: no return value
- Call this method to cancel and close the wizard. The code in the
onwizardcancelattribute is called before the wizard is cancelled.
- extra1()
- Return type: no return value
- Call this method to simulate clicking the extra1 button. The code in the onextra1 attribute is called.
- extra2()
- Return type: no return value
- Call this method to simulate clicking the extra2 button. The code in the onextra2 attribute is called.
- getButton( type )
- Return type: button element
- Returns the button element in the dialog corresponding to the given type.
- getPageById( pageID )
- Return type: wizardpage element
- Returns the wizardpage element corresponding to the specified pageID.
- goTo( pageID )
- Return type: no return value
- This method is used to change which page is currently displayed, specified by the pageID argument. The page will be changed regardless of the value of canAdvance or canRewind. The onwizardback and onwizardnext code is not called when using this function.
- rewind()
- Return type: no return value
- Call this method to go back a page. It is equivalent to pressing the Back button. The canRewind property must be set to
truefor the page to be changed. The code in the onwizardback attribute is called before the page is changed.