Page 377
can place a button item next to the text item. This button is reduced in size, and makes the item appear to be a pick list. The users like this feature because when they see the button, they know it will open a list of some sort by simply clicking the button.
FIG. 14.36
The DEPT LOV used to
return values to the
fk_department item.
To create the button on the form, perform the following:
Figure 14.37 shows the button on the Layout Editor after these changes have been made.
FIG. 14.37
The layout editor
containing the
reformatted LOV button.
Page 378
The final step is to create a trigger that will be activated when the button is clicked. This will require a When-button-pressed trigger to be assigned to the button. We will discuss creating triggers in the next section. Figure 14.38 displays the text of the trigger.
FIG. 14.38
The When-Button-
Pressed PL/SQL
statements that cause
the display of the LOV.
The script causes the form to shift the input focus to the fk_department item on block ONE. After changing the focus, it displays the LOV linked to the fk_department item.
Occasionally, it is necessary to modify the record group. This occurs when the developer wants to add another column to a LOV. Modifying the Record Group Query property changes the query. The record group property sheet is displayed in Figure 14.39. When the Record Group Query is selected, the property sheet will display a yellow button at the top of the sheet. Clicking this button opens an edit window that can be used to modify the query. Clicking the OK button will cause forms to compile and validate the query. It may then be used to modify or create a LOV.
When the developer creates a master/detail form, Forms creates an object called a relation, a child object of the master block. It contains the conditions that relate the two blocks. Generally it is not necessary to use this object. However, sometimes the join condition needs to be
Page 379
modified. Changes in the database tables or possibly an error by the developer may cause this. Rather than dropping the detail block it may be easier to modify the Join Condition property of the relationship. Figure 14.40 displays a relationship property sheet.
FIG. 14.39
The record group
property sheet and the
record group query edit
window.
FIG. 14.40
The relationship
property sheet for block
ONE and block TWO of
the Employee Update
form.
Forms often contain records from multiple tables. The records from the two tables are related in a master detail relationship. Forms enables the developer to add blocks related to existing blocks. Using the master-detail tab of the New Block dialog does this. The chapter discussed the creation of two detail blocks for the Employee Update form.
The form object has a number of properties or attributes. The coordinate information setting determines the coordinates used in the Forms designer to place objects. The current record attribute uses a visual attribute to change the look of the current block record. The menu property is used to identify the menu used by the form. The cursor mode determines the navigation range of the cursor.
The block object also has a number of properties. The base table property contains the name of the table or view. The delete allowed, insert allowed, and query allowed settings determine whether these functions can be performed on the block. The navigation style determines where the cursor navigates after tabbing from the last item. The order by and where clause properties order the records and limit the number selected. The records displayed property determines the number of record displayed by the form.
Page 380
There are eleven types of items that can be displayed on the canvas: push button, check boxes, chart items, display items, images, list items, OLE containers, radio groups, text items, user areas, and VBX controls. The items contain a variety of properties. The alignment property control justification. The Font properties control the text format. The LOV property determines the LOV used for the item. The required property determines whether the item must have a value. The Multi-Line property is used to enable the user to enter text on multiple lines of the item.
A LOV is an item that can be used to display a dialog box that displays values for the item. The LOV can be used to validate values entered into the item. A relationship is an object that contains the conditions of the join between a master and detail block.
The next chapter covers triggers. Triggers are events that execute PL/SQL code. The chapter describes how to incorporate triggers into the form. It also covers the PL/SQL editor. It is the tool used to write the PL/SQL. The chapter also covers built-in subprograms, system variables, global variables, and alerts. The last part of the chapter describes a template security scheme that can control who updates a form.
Use the a_13_02.fmb to perform these exercises.