Now you create a w_orders window.
Select File -> New.
In the PB Object tab, select Window and click OK.
On the General tab of the window Properties view, make sure the following values are set:
Window property |
Value |
---|---|
Title |
SalesDB tutorial |
MenuName |
m_salesdb |
Visible |
selected |
Enabled |
selected |
Show SIP Button |
selected |
Close (OK) |
selected |
Selecting the Show SIP Button property makes the Soft Input Panel in the Pocket PC available to the user. Selecting the Close (OK) property adds an OK icon to the title bar of the window in the Pocket PC; when the user clicks OK, the application closes.
On the Scroll tab of the window Properties view, select the HScrollBar and VScrollBar check boxes.
Select File>Save to save the window.
Type w_orders
as
the name of the window.
Click OK.
Select Insert>Control>DataWindow.
Click the window in the Layout view to insert a DataWindow control in the w_orders window.
Click and drag the borders of the DataWindow object to size it, leaving space at the bottom of the window for navigation buttons.
Change the DataWindow control properties on the General tab of the Properties view to these values:
DataWindow control property |
Value |
---|---|
Name |
dw_orders |
DataObject |
d_orders |
HScrollBar |
checked |
VScrollBar |
checked |
You should now see the column labels inside the DataWindow control.
Select Insert>Control>CommandButton.
Click in the window below the DataWindow control to add the command button.
Name the button cb_prev with command button text < Previous.
Repeat the preceding step with the following settings:
Command button name |
Value |
---|---|
cb_next |
Next > |
cb_approve |
Approve... |
cb_deny |
Deny... |
Rearrange the position of the DataWindow control and buttons so the resulting window looks like this:
Next you associate events with the buttons.
Double click the cb_prev button.
Make sure the clicked( ) event displays in the Script view.
Type the following code in the Script view.
f_scroll(-1)
This function scrolls data in the DataWindow back by one row.
In the Script view, select the each of the other command buttons from the first drop-down list and type the code shown below for the clicked event of that command button:
Command button name |
Code |
---|---|
cb_next |
f_scroll(1) |
cb_approve |
f_approve_deny(APPROVE) |
cb_deny |
f_approve_deny(DENY) |
Select File>Save to save the changes.
Close the Window painter.
Now you must tell the application to open the window when the application starts.
In the System Tree, double-click the salesdb_tutorial Application object.
In the second drop-down list in the Script view, select the open event.
Uncomment the section following the text: Uncomment
the following section after creating w_orders
.
Leave the comments that start with a double slash (//)
unchanged.
Uncommenting code
You can use comments in code to document your scripts or prevent statements
within scripts from executing. In this step and the next few steps,
you uncomment scripts that have been commented to prevent them from
executing. The slash-and-asterisk method of commenting code looks like
this: /*
Code */
,
where Code can refer to any number of lines
of code. You uncomment the code by deleting the /*
and
the */
characters
that surround the code.
The double slash method of commenting code can comment out only a single line of code at a time. The tutorial uses this method to include descriptive text. If you remove the comments from the descriptive text, the PocketBuilder compiler will indicate a compilation error.
Here is what you should see in the Script view now:
This code had to be commented out before you created the w_orders window. Since you created the window at the beginning of this lesson, you can now uncomment the code without causing the PocketBuilder compiler to issue an error message.
In the second drop-down list, select the ue_postopen event.
Uncomment the section following the text: Uncomment
the following section after creating w_orders
.
Leave the comments that start with a double slash (//) unchanged.
Select File>Save to save the changes.
Close the Application painter.
In the System Tree, double-click the m_salesdb menu.
Expand Order, and double-click the Delete submenu item.
Uncomment the section following the text: Uncomment
the following section after creating w_orders
.
Leave the comments that start with a double slash (//) unchanged.
Select File>Save to save the changes.
Close the Application painter.
In the System Tree, double-click the f_scroll function.
Uncomment the section following the text: Uncomment
the following section after creating w_orders
.
Leave the comments that start with a double slash (//) unchanged.
Select File>Save to save the changes.
Close the Function painter.
Repeat steps 18 and 19 for f_scroll_last, f_approve_deny, f_refresh_orders and f_set_dir_btn_enabled.
The SalesDB application is now ready to be tested.