Getting Started-2-Tier |
In this lesson, you test the screen that you created in Lesson 4. You can test this screen either within the editor or in the browser. You also learn how the transaction manager controls an application's behavior and appearance.
In this lesson you learn how to:
In your web browser, you can test any screen that is stored in the web application library.
Test the screen in the browser
Type the following from the command line of the WebInstallDir
/util
directory:
UNIX monitor -start
WebAppname
Windows monitor -start
WebAppname
http://hostname/cgi-bin/WebAppname/dstord.scr
The screen appears in the browser.
To continue testing the screen in the web browser, skip to Step 5.
You can also test and debug any screen within the editor. The editor's graphical environment shows how the screen appears and behaves in the host GUI platform. Any changes that you make to a screen can be tested immediately without saving edits, so you can experiment without committing to the changes. For more information about test mode, refer to Chapter 38, "Testing Application Components," in Application Development Guide.
With the screen that you just built, you can access real data from the vidsales
database. The commands associated with the screen's buttons let you access and maintain data in the database.
If necessary, open the vidsales
database (DatabaseConnect).
The first record in the distributors
table displays.
After you press View, the Save and Delete buttons become inactive. The active or inactive state of buttons depends on the last command to execute. In this case, the request to view records prevents you from saving or deleting records.Panther's transaction manager protects widgets from data entry by the style that it applies to each one. Styles can set a widget's color and protections. In this case, they activate and deactivate (gray out) push buttons without requiring you to write any code. You can change the behavior of the default styles with the styles editor, or change the widget's style assignment in the editor.
Also, because the View command only allows read access, the record data display as literal text and not inside input fields.
All values are cleared from the fields and the Reset command closes the current transaction, so that you can execute another transaction command.
More About the Transaction Manager
You can create complex database query/update screens without having to write any code. That's because the transaction manager "knows" about the interaction between database tables and columns (via information retrieved from the database during the importation process). Given this information, the transaction manager generates the appropriate SQL statements for fetching or updating the database, and keeps track of any data changes. When your application issues the SAVE command, the transaction manager automatically generates SQL commands to update the database to match the data on the screen.
In order to update database records, you must select them. When you select records for update, by default Panther protects primary key fields from data entry. This is a result of Panther's application of a style to each widget.
The Select command selects a record for update. The first record in the distributors
table displays.
The value in distrib_id
is shown as read-only because it is a primary key in the distributors
table; in general, primary key fields in database tables cannot be changed.
P.O. Box 133
. Here you can enter data and edit existing data on the screen.
To save your changes to the database, you must issue a Save command.
Panther calls the update procedure to update the database.
Note: The following is only true for Windows. In Motif, the system menu is available, and you can choose close.
More About Wizard-generated Buttons
The transaction-specific buttons generated by the screen wizard let users update, insert, select, and delete database records. IN general, the buttons operate on the master table and any other updatable tables on the screen. However, on some screens, the default behavior might have unwanted results. For instance, the Delete button on the
dstord.scr
client screen deletes the master and the associated details. Because the order items associated with the detail are not present on the screen, these would be orphaned. Therefore, you might want to remove the Delete button from this type of screen.
The transaction menu options in the test mode offer functionally that is equivalent to the buttons.
In this lesson, you tested the Distributor Order screen by performing these tasks:
vidsales
database.
You learned:
What did you learn?