Previous | Table of Contents | Next

Page 367

values. I use a radio group or check box for less than three values and a list-of-values when more than 15 values are needed or the list of values can change.

Three types of list items are available: Poplists, TLISTS, and Combo Boxes. Figure 14.24 shows the three types. Each of the three contains a down-arrow on the right side of the item. Pressing this button on the poplist will cause a drop-down list of values to appear. A Poplist item cannot be inputted or updated directly. Selecting a value from the list must populate it.

A Combo Box is a cross between a text item and a poplist. It contains an arrow on the right side that drops the predefined value list. The user can select a value from the list to populate the item. This is the same as a poplist. Unlike a poplist item, a combo box item is enterable. The user can enter a value directly into the item. This means the combo box item may contain values that do not match the predefined list.

The TLIST List contains an up- and down-arrow on the right side. This item does not show the entire value list. It only shows the currently selected value. Pressing the up-arrow will display the previous value, and pressing the down-arrow will display the next value from the list.

FIG. 14.24
Examples of a Poplist,
TLIST, and Combo Box.



Perform the following steps to create an item list:

  1. Create an item by using the Layout Editor tool palette, or the New Block dialog box, or the create button on the object navigator. Be sure the item type is List Item.

  2. Open the item's property sheet. Locate the Functional properties located near the bottom of the property sheet. Select the type of list by using the List Style property.

  3. Select the List Elements property. This will cause a button labeled More to appear at the top of the sheet. Click this button, and a List Item Elements dialog box appears.

  4. This dialog box contains each of the list's values and a corresponding description. Enter the value descriptions in the top box labeled List Elements. Enter the actual value in the lower box labeled List Item Value. Click OK when done.

  5. Open the Layout Editor. Position and format the list item to suit.

Page 368

As an example, the state column on the Employee Update form will be changed to a poplist item. The first step is to open the property sheet, as shown in Figure 14.25. The Item Type property, which is not displayed, has been changed to list item. The figure displays the item's functional properties. The List Style property is poplist. The List Elements property is selected and the More button appears at the top of the property sheet.

FIG. 14.25
The functional
properties on the
State Item property
sheet.



Clicking the More button brings up the List Item Elements dialog box to the right of the property sheet. This dialog box records the values that appear on the poplist and its associated actual value retained in the database. The top window contains the descriptions and the bottom window contains the actual value. The value in the List Item Value window corresponds to the element in the top box that is currently selected. Clicking the OK button will save the values. The default property on the property sheet must be filled in with a value from the list. You will get a compile warning when the default property is empty.

TIP
On some of the list items, it's nice to have a null as the default value. In order to create a null on the list, select the element row immediately following the last description. Then remove the corresponding value in the bottom window. This procedure will validate the lack of a value in the item's default property.

The final step is to open the Layout Editor to position and format the item. Figure 14.26 displays the executed Employee Update form with the State list item.

Using Images

The image item type displays an image that is read into the form during runtime. The image can be contained in the database or in an external file. The image is read into the form by firing a trigger. An image can be a useful device. For example, suppose that the user wants to view an image of each employee on the Employee Update form. This can be achieved by creating an image item and displaying the employee's scanned image file into the image item. The example later in this section will display the employee's image on the Employee Update form.

Page 369

FIG. 14.26
The Employee Update
form with an open
poplist for the State
item.



Perform the following to create an image:

  1. Create an item by using the Layout Editor tool palette, or the New Block dialog box, or the create button on the object navigator. Be sure the item type is Image.

  2. Open the property sheet and locate the Functional properties. Change the Sizing Style to adjust. If the image does not come from the database, be sure to change the Base Table Item to false.

  3. Open the Layout Editor. Size and position the image item.

  4. Create a trigger that will populate the image by using the read_image_file built-in function.

The images of each employee in our employee database were scanned into PCX files. They are contained on the CD. The name of each file begins with the employee's payroll number followed by the expression EMP.TIF. Concatenating the employee number to the front of the filename makes each file unique and allows the form to easily identify the corresponding file. For example, Ronald Reagan's employee number is 35 and the image file is 35EMP.PCX.The following are the steps to add an image item to the Employee Update form:

  1. The first step is to create the image item. Start by clicking the image tool on the Layout Navigator. The image item should be on block "ONE."

  2. Place and size the image by using the drag handles. Open the property sheet and change the Base Table Item to false and the Sizing Style to false.

Figure 14.27 displays the image property sheet after the properties have been modified.

The next step is to create a trigger that will load the image file into the form image. Triggers will be discussed triggers in greater depth in the next chapter. The trigger used in this example is a block-level post-query trigger. This means when Oracle displays a new record on the block, this trigger will be executed or fired. The trigger contains the PL/SQL commands that will populate the image item.

Previous | Table of Contents | Next