In this lesson you will create a multi-page application, called a pageturning application, that lets the user move from one page to another, as if turning the pages in a book. You'll learn how to set up buttons that let the user move from page to page. These buttons will exist on a background page so that the same navigation tools will be available for each standard page that displays. The application, called Pageturn.jmb, will have three pages. One page will be a background page that contains the buttons that let the user navigate forward and backward. The other two pages will contain the content that the user can view.
Note: A completed version of this lesson, called lesn_4, is located in the \Jamba\lessons directory.
First, you'll create a new project.
Choose New... from the File menu.
The New Project dialog box appears.
In the New Project dialog box, type Pageturn in the Name field, set the Page width to 200, the Page height to 170, then click on the OK button.
Note that if you position the cursor over a button and wait a moment, Jamba displays a tool tip to tell you the name of the button.
Draw a Picture Push Button (called BgPicturePushButton1) in the lower left corner of the page.
Right click on the object and select Properties from the pop-up menu.
The Object Editor displays the properties for BgPicturePushButton1. First, you'll rename the object so that it has a simpler name.
Set the Name property to BackwardButton. Hint: Type the new name and press Return.
Note that in the Object List, Jamba always places the characters "Bg" in front of the object name to identify it as an object on a background page.
You're almost ready to set up the rest of the object, but before you continue, you need to learn a little about how Picture Push Buttons work. At runtime, the object will contain the image of a left-pointing arrow. When the button is enabled, it will appear as follows:
Note however, that the graphic file you load into the object actually contains three distinct images, each showing the button in its three possible states: Up, Down and Disabled. In its entirety, the actual graphic file appears as follows:
First, you'll set the ButtonStyle property to let Jamba know how many states are represented by the images in the file. This property can be set to Up, UpDown, or UpDownDisabled. Jamba divides the graphic depending on the state you choose, so all images must be of equal size and in one file.
Set BgBackwardButton's ButtonStyle property to UpDownDisabled.
Now you can load the file into the object.
Set BgBackwardButton's Filename property to Rnd_bk.gif. Hint: You can find this file in the Jamba\lessons\Graphics directory.
To complete the object, you need to set its Enabled property to False. Remember, when the application first runs, you want the user to be able to advance, but not go backwards. (The Backward button will be enabled only when the user is viewing the second page.)
Set BgBackwardButton's Enabled property to False.
The button appears in the Disabled state.
Now you are ready to create the second Picture Push Button that lets the user advance to the next page. To save time, you'll make a copy of BgBackwardButton and make minor changes to it.
Right click on BgBackwardButton and choose Copy from the popup menu.
Right click on the page and choose Paste from the popup menu.
A new Picture Push Button, once again called BgPicturePushButton1, is pasted directly over the original button.
Drag the new button to the bottom right corner of the page.
Set the Name property of BgPicturePushButton1 to ForwardButton.
The file that you will load into BgForwardButton appears as follows:
Note that the object's ButtonStyle property is already set. Now you'll load the new file.
Set the BgForwardButton's Filename property to Rnd_fwd.gif. Hint: You can find this file in the Jamba\lessons\Graphics directory.
The last task is to set the object's Enabled property to True. Because when the page first displays, this Forward button should be available to the user.
Set the BgPicturePushButton2 object's Enabled property to True.
The Background page is complete, except for its To Do Lists. You'll come back to this page later on, after you finish setting up the other two pages.
Click on the X in the top right corner of the Background1 page window.