Forms Builder Components Items

Working in the Forms
Developer Environment
Copyright © 2004, Oracle. All rights reserved.
Objectives
After completing this lesson, you should be able to do
the following:
• Describe Forms Builder components
• Navigate the Forms Builder interface
• Identify the main objects in a form module
• Customize the Forms Builder session
• Use the online help facilities
• Identify the main Forms executables
• Describe the Forms module types
• Set environment variables for design and run time
• Run a form from within Forms Builder
3-2
Copyright © 2004, Oracle. All rights reserved.
Forms Builder Key Features
With Forms Builder you can:
• Provide an interface for users to insert, update,
delete, and query data
• Present data as text, image, and custom controls
• Control forms across several windows and
database transactions
• Use integrated menus
• Send data to Oracle Reports
3-3
Copyright © 2004, Oracle. All rights reserved.
Forms Builder Components:
Property Palette
•
•
3-4
Copy and paste
properties
Fast search
feature
Copyright © 2004, Oracle. All rights reserved.
Forms Builder Components:
Layout Editor
Toolbar
Tool
palette
3-5
Copyright © 2004, Oracle. All rights reserved.
Forms Builder Components:
PL/SQL Editor
With the PL/SQL Editor you can:
• Use PL/SQL in Forms.
• Enter and compile code.
3-6
Copyright © 2004, Oracle. All rights reserved.
Getting Started in the Forms
Builder Interface
•
•
Start Forms Builder
Connect to the database:
– Menu:
Select File > Connect
Or
– Toolbar:
Click Connect
3-7
Copyright © 2004, Oracle. All rights reserved.
Blocks, Items, and Canvases
Canvas 2
Canvas 1
Items
Block A
3-8
Copyright © 2004, Oracle. All rights reserved.
Items
Block B
Forms Builder Components
– Items: These are interface objects that present data
values to the user or enable the user to interact with
the form, depending upon the item type. There are
several different types of items. Items are logically
grouped into blocks and visibly arranged on
canvases.
– Blocks: A block is the intermediate building unit for
forms. Each form consists of one or more blocks. A
block is the logical owner of items, and each item in
a form belongs to a block. Items in one block are
logically related; for example, they may correspond
to columns in the same database table or may need
to be part of the same navigation cycle.
Blocks therefore provide a mechanism for grouping
related items into a functional unit for storing,
displaying, and manipulating records.
3-9
Copyright © 2004, Oracle. All rights reserved.
Forms Builder Components (continued)
Canvases: A canvas is a “surface” where visual objects,
such as graphics and items, are arranged. A form module
can have several canvases (like the pages of a paper form).
A canvas can display items from one or more blocks. To see
a canvas and its items, you must display the canvas in a
window. By default, all canvases in a form appear in the
same window (which could mean you see only one canvas
at a time), but you can assign separate windows for each
canvas so that several canvases can be viewed at once.
3-10
Copyright © 2004, Oracle. All rights reserved.
Navigation in a Form Module
•
•
3-11
When you run a form, you principally navigate by
way of items and blocks, not by canvases. Each
item has a sequenced position within its block,
and each block has a sequenced position in the
form.
When a user requests to move to the next item in a
block, focus will be set on the next item in
sequence, wherever that may be. If the next item is
on a different canvas, Oracle Forms Developer
displays that canvas automatically. Similarly,
users can request to move to the next block (or
previous block). If the first item in this block
resides on another canvas, then that canvas is
displayed automatically.
Copyright © 2004, Oracle. All rights reserved.
Data Blocks
A B C
Master Data Block
A
B
C
2
D
3
Table
4
1
X
Detail Data Block
Y
Z
5
X Y Z
6
Table
3-12
Copyright © 2004, Oracle. All rights reserved.
Types of Blocks
•In Forms Builder there are two main types of blocks: data blocks and control
blocks.
Data Blocks
When you build database applications with Forms Builder, many of the blocks
will be data blocks. A data block is associated with a specific database table
(or view), a stored procedure, a FROM clause query, or transactional triggers.
• If it is based on a table (or view), the data block can be based on only one
base table, even though the data block can be programmed to access data
from more than one table and data sources. By default, the association
between a data block and the database enables the user to automatically
access and manipulate data in the database. However, to access data from
other tables (nonbase tables), you need to write triggers.
1
2
3
4
5
6
3-13
Base table source
Single-record data block
Trigger access
Nonbase table source
Multirecord data block
Record
Copyright © 2004, Oracle. All rights reserved.
Types of Blocks
• Data Blocks
When you build database applications with Forms
Builder, many of the blocks will be data blocks. A
data block is associated with a specific database
table (or view), a stored procedure, a FROM clause
query, or transactional triggers.
• Control Blocks
A control block is not associated with a database, and
its items do not relate to any columns within any
database table. Its items are called control items.
For example, you can create many buttons in your
module to initiate certain actions and to logically
group these buttons in a control block.
3-14
Copyright © 2004, Oracle. All rights reserved.
Master Versus Detail Blocks
•
•
•
3-15
To support the relationship between data blocks
and their underlying base tables, you can define
one data block as the detail (child) of a master
(parent) data block. This links primary key and
foreign key values across data blocks, and
synchronizes the data that these data blocks
display.
Forms Builder automatically generates the objects
and code needed to support master-detail
relationships. As the designer, you need only
request it.
Note: If your application requires it, you can also
create independent data blocks in which there is
no relationship between the two data blocks.
Copyright © 2004, Oracle. All rights reserved.
Forms and Data Blocks
Block 1
Block 1
Block 1
Form C
Block 2
Open Form
Block 2
Block 3
Open
Form
Form A
Block 4
Form B
Multiple Form Modules
Single Form
Module
3-16
Block 1
Copyright © 2004, Oracle. All rights reserved.
Form Module Hierarchy
Module
Database
Table
Blocks
Column
Trigger
Trigger
Program
Program
Units
units
Frame
Item
Item
Item
Canvas
Trigger
Trigger
Window
3-17
Copyright © 2004, Oracle. All rights reserved.
Multi-Block and Multi-Form Applications
•
•
3-18
A form module is made up of one or more blocks.
A data block is based on a database object, such
as a table or a view. A data block can contain both
data items and control items. A frame can be
created to arrange data block items. Each item in a
block must appear on a canvas, and each canvas
must appear in a window. A form module can have
one or more canvases and windows.
Using triggers, you can add functionality to your
form. Triggers can be written at different levels in
a form module. User-named program units enable
you to write additional PL/SQL code through
procedures, functions, and packages.
Copyright © 2004, Oracle. All rights reserved.
Customizing Your Forms Builder Session
3-19
Copyright © 2004, Oracle. All rights reserved.
• What Are Oracle Forms Developer Preferences?
You can use preferences to customize some aspects
of your Forms Builder session.
• To modify preferences, perform the following
steps:
1. Select Edit > Preferences.
2. Specify any options that you require.
3. Click OK to save changes, or Cancel to cancel
changes.
3-20
Copyright © 2004, Oracle. All rights reserved.
Testing a Form: The Run Form Button
•
With the Run Form menu command
or button, you can:
– Run a form from Forms Builder
– Test the form in a three-tier environment
•
The Run Form command takes its settings
from Preferences:
– Edit > Preferences
– Runtime tab
– Set Web Browser
Location if desired
– Set Application Server
URL to point to Forms
Servlet:
http://127.0.0.1:8889/forms90/f90servlet
3-21
Copyright © 2004, Oracle. All rights reserved.
To Exit a session
•
•
3-22
The correct way to exit a Forms session is to exit
the form (File > Exit, or click Exit), then close the
browser. If you close the browser without first
exiting the form, your session may hang.
You will notice this because you may not be able
to recompile the same form, but will receive the
error: FRM-30087: Unable to create form
file. If this happens, you will need to open Task
Manager and end the ifweb90 process manually.
Copyright © 2004, Oracle. All rights reserved.
Practice 3 Overview
This practice covers the following topics:
• Becoming familiar with the Object Navigator
• Setting Forms Builder preferences
• Using the Layout Editor to modify the appearance
of a form
• Setting run-time preferences to use OC4J to test
applications
• Running a form application from within Forms
Builder
3-23
Copyright © 2004, Oracle. All rights reserved.