Getting Started-2-Tier


Lesson 5 . Testing Screens

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:

Test the screen in the browser

In your web browser, you can test any screen that is stored in the web application library.

  1. If necessary, start the Panther web application.

    Type the following from the command line of the WebInstallDir/util directory:

    UNIX monitor -start WebAppname

    Windows monitor -start WebAppname

  2. To invoke the screen that you created in Lesson 4, supply its URL in the following format:
    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.

Test the screen in GUI

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.

  1. If necessary, restart the editor and open dstord.scr.
  2. Choose FileTest Mode to test the screen.

View data

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).

  1. Choose .

    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.

  2. Choose .

    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.

Edit the data

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.

  1. Choose .

    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.

  2. Click in or tab to the Address2 field and enter P.O. Box 133. Here you can enter data and edit existing data on the screen.

Save the changes

To save your changes to the database, you must issue a Save command.

  1. Choose .

    Panther calls the update procedure to update the database.

  2. To close the current transaction, choose .

    Note: The following is only true for Windows. In Motif, the system menu is available, and you can choose close.

  3. (Windows only) Press Escape twice to exit test mode if viewing in GUI.

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.


What did you do?

In this lesson, you tested the Distributor Order screen by performing these tasks:

What did you learn?

You learned: