Basic Forms Concepts
A form simply allows you to work visually with the data in the database. It is a representation of the data in the database tables, a collection of objects that yields a graphic interface to the data.
Every form, no matter how simple, contains the following pieces: ▪ At least one block
▪ At least one item
▪ At least one canvas
▪ At least one window
Most Oracle Forms 10g have multiples of each of these objects, but the basics are the same, no matter how simple or complex the form.
In addition to the basic objects in a form, the toolkit supports a wide variety of widgets and interface items to build the user experience: buttons, toolbars, check boxes, radio buttons, even Java-bean controls. PL/SQL code behind these objects (and in the database) controls validation and behavior in the form.
Blocks are the form elements that connect the displayed items on the screen to the database.The block itself is never seen when a form is running; only the items that it contains are displayed on the canvas. [pic]
Figure 3-1: A graphical description of database tables and Oracle Forms 10g canvases
Blocks can be based on single database tables, multiple tables (via a view), and even the returned values from a PL/SQL package. Blocks can also be created that are not connected to (not bound) to the database at all. These are commonly called Control Blocks or non-base table blocks (NBTs). Control Blocks can be used to hold working variables, reference values, or any other data that is used or displayed within the Form.
When a block is associated with tables in the database, Oracle Forms 10g handles the standard DML functions automatically. Select, Insert, Update, and Delete are supported for these blocks without having to write additional code. When the block is based on a view, limited ability to perform DML is supported (based on the rules for updatable views). When the block is based on PL/SQL code, or when you want to perform nonstandard functions when the user attempts to update or delete items in the form, then PL/SQL code can be written to perform the desired action and override the standard DML functions. For example, if a user deletes a record on screen, but the system requires that items never be deleted (they must be marked inactive instead), then the delete function can be “replaced” by PL/SQL code to set the appropriate flags invisibly to the user. For the standard behavior, however, no code is required. Oracle Forms 10g handles the interaction automatically.
Items and Data Items
Items are the form elements that connect the form to a column in the database table (or, as noted in the preceding section, “Data Blocks,” a returned value from PL/SQL). Items can only be created within blocks. They are the pieces of a block that are seen when the form is running. The items may be bound to the database, in which case they represent a column in the table or view being bound, or a value returned by a PL/SQL package. Or, the item may be a calculated value or reference value from a Control Block.
Cursor navigation at run time is controlled by the orientation of the data blocks and items set at design time in the Object Navigator. By default, the cursor goes to the first item on the first block of the form, and then moves through each block and item in the form. By rearranging the data blocks and items, the navigation sequence at run time can be controlled.
There are other ways to control navigation: programmatically or by hard-coding the sequence of items. It is always preferable to use the physical ordering of item and blocks to control navigation.
Finally, you can specify what behavior should occur when you reach the last item in a record. The cursor can return to the first item in the same record, can move to the next record, or can move to the next block in the form.
Blocks can be displayed on the canvas...
Please join StudyMode to read the full document