User Tools

Site Tools


how_to_create_a_wizard.htm
Navigation:  How To's and Troubleshooting > How to… >====== How to Create a Wizard ====== Previous pageReturn to chapter overviewNext page

NewC7.jpg

A wizard is a window with a “tabless” SHEET control containing one or more TABS. You'll need to write the code to handle the “turning of the pages”.

This topic explains one method of creating a wizard using <;<;Back and Next» buttons.

1.  Create a procedure using the Window Template.

2.  Create two Local Variables (by pressing the Data Button on the Procedure properties dialog).

Label Data Type Initial Value
TabNumber Byte 1
MaxTabs Byte number of desired TABs

3.  Place a SHEET Control on the Window.

4.  Place the desired number of Tabs on the SHEET.

5.  Design each TAB.

6.  In the Properties Pad, set the Wizard property to true for the SHEET control.

This adds the WIZARD attribute to the SHEET control, which hides the “tab” portion of the TAB controls. Waiting to add this attribute until after designing the TABs makes TAB design easier.

7.  Place two button controls under the SHEET control.

Use Text
?Back <;<;Back
?Next Next»

8.  Place a third button control under the SHEET control using either a standard button, a Save Button Control template, or a Close Button control template.

Use Text
?Finish Finish

The type of control will depend on the task you intend the wizard to perform. If you are using a Save Button control template, you will need to either call the wizard from a browse or set GlobalRequest=InsertRecord in the WindowManager Method Executable Code – INIT [Priority First] embed point.

9.  In the point after WindowManager Method Executable Code – INIT–Open The Window (Priority 8250)

       HIDE(?Finish)

       Select(?sheet1,TabNumber)

       Disable(?Back)

This hides the Finish button and disables the <;<;Back button when the window opens.

10.  In the Control Event Handling–?Back, Accepted embed point, add this code and set the Priority to 2500:

       TabNumber -=1

       CASE TabNumber

       OF 1

        HIDE(?Finish)

        DISABLE(?Back)

        SELECT(?SHEET1,TabNumber)

       OF MaxTabs

        UNHIDE(?Finish)

        DISABLE(?Next)

        SELECT(?SHEET1,TabNumber)

       ELSE

        HIDE(?Finish)

        ENABLE(?Back)

        ENABLE(?Next)

        SELECT(?SHEET1,TabNumber)

       END

This code decrements TabNumber, disables inappropriate buttons, and keeps the Finish button hidden until the final TAB.

11.  In the Control Event Handling–?Next, Accepted embed point, add this code and set the Priority to 2500:

      TabNumber +=1

      CASE TabNumber

      OF 1

       HIDE(?Finish)

       DISABLE(?Back)

       SELECT(?SHEET1,TabNumber)

      OF MaxTabs

       UNHIDE(?Finish)

       DISABLE(?Next)

       SELECT(?SHEET1,TabNumber)

      ELSE

       HIDE(?Finish)

       ENABLE(?Back)

       ENABLE(?Next)

       SELECT(?SHEET1,TabNumber)

      END

This code increments TabNumber, disables inappropriate buttons, and keeps the Finish button hidden until the final TAB.

12.  Write the code for the Finish button to accomplish the desired tasks and close the window.

how_to_create_a_wizard.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1