Page 355
In the previous lesson, you were introduced to some basic concepts about Developer/2000 and started to work with Oracle Forms. You learned how to build a simple default form based on a single table. In this lesson, you continue with the Forms Designer and build a master-detail form. You also learn how to customize the appearance of a form with the Layout Editor.
NEW TERM
A master-detail form is a form that contains two blocks, the master and detail blocks, which display database records. The master and detail blocks are synchronized; when a record is displayed in the master block, the detail records associated with the master record are displayed in the detail block. For example, a master-detail form might have a master block associated with the
Page 356
Department table and a detail block associated with the Instructor table; when a particular department record is displayed in the Department block, the instructor records associated with that department are displayed in the Instructor block.
NOTE |
There are many properties for each object type in Oracle Forms. There simply aren't enough pages in this book to examine the nuances of each of these properties. Instead, I concentrate on the most important object properties. |
On Day 12, "Developer/2000: Introduction to Oracle Forms," you used the Forms Designer to build a simple form for viewing and editing student information. Now, you're going to learn how to build a master-detail form. Specifically, you are going to build a form for scheduling a department's classes. The master block will contain the department, and the detail block will contain the classes to be offered by the department. To begin, invoke the Forms Designer by selecting Start | Programs | Developer/2000 for Win95 | Forms Designer. Next, connect to the Oracle database with the username, password, and database alias that you used in the previous lesson. By default, the Forms Designer creates a form named Module1.
To define the master block for your form, follow these steps:
Page 357
Figure 13.1.
Restricting the list of
database objectsto
tables owned by the
current user.
Figure 13.2.
Selecting the Depart-
ment table for the
master block.
Figure 13.3. Page 358
Selecting the Depart-
ment table columnsto
include in the master
block.
Figure 13.4.
Setting the layout
options for the master
block.
As you can see in Figure 13.5, the Object Navigator will display the two new blocks: Department and Button Palette (which is the control block created when the Button Palette checkbox is checked). You have now created the master block.
Figure 13.5. Page 359
Object Navigator
displays the two new
blocks.
NOTE |
Notice that you didn't set any properties to indicate that this block is the master block. It is the master block because you are about to create another block that will identify Department as the master block. |
To create the detail block, you'll follow many of the same steps needed to create the master block:
Figure 13.6.
New Block Options
window for detail
block.
Next, select the Layout tab. This time, be sure the Style field is set to Tabular and the Orientation is Vertical. Set Records to 10. Set the Integrity Constraints and Scrollbar checkboxes.
Follow these steps to define the relationship between the master and detail blocks:
Page 360
Figure 13.7.
Choosing the master
block.
Figure 13.8.
Join condition created
by the Forms Designer.
Let's look at the canvas that has been created. Select Tools | Layout Editor from the
menu. Figure 13.9 displays what you should see with the Layout Editor. As you can see, there
are a lot of changes you'll need to make to the form before you actually use it. In the
next section, you learn how to use the Layout Editor to modify the appearance and properties
of the block items.