You are on page 1of 242

Version –0.

1D
10th August 2005
D2K For ms Builder
D2K For ms Builder

Table of Contents

1 Introduction to Developer / 2000 ...........................................................................................6


1.1 Introduction to Client-Server Computing Model ...............................................................6
1.2 Introduction To Developer 2000 ........................................................................................8
1.3 Builders...............................................................................................................................8
1.4 Hardware requirements for Developer 2000 ......................................................................9
1.5 Common Features of Oracle Developer/2000 Products. ..................................................10
1.6 Features of Developer 2000..............................................................................................13
2 Introduction to Forms 5.0 ....................................................................................................14
2.1 Introduction to Forms 5.0.................................................................................................14
2.2 Application Partitioning ...................................................................................................16
2.3 Basic Operations...............................................................................................................17
2.4 Designer Interface ............................................................................................................19
2.5 Introduction to forms interface items ...............................................................................30
3 Blocks and Form Items .........................................................................................................32
3.1 Introduction to Blocks ......................................................................................................32
3.2 Form Builder Wizard........................................................................................................35
3.3 Create A data block (Data Source Table) .........................................................................36
3.4 Create a data block (Stored Procedure) ............................................................................47
3.5 To create a control block..................................................................................................53
3.6 Creating Form Items .........................................................................................................54
3.7 Form Templates ................................................................................................................69
4 Master Detail Relationship...................................................................................................71
4.1 Introduction ......................................................................................................................71
4.2 Join Condition ..................................................................................................................71
4.3 Block Co-ordination .........................................................................................................71
4.4 Relation Object .................................................................................................................72
5 Events and Triggers ..............................................................................................................80
5.1 Events and Triggers..........................................................................................................80
5.2 Processes in Forms ...........................................................................................................85
D2K For ms Builder

6 Property Classes and Visual Attributes............................................................................102


6.1 Introduction to Property Class........................................................................................ 102
6.2 Creating a Property Class ............................................................................................... 102
6.3 Defining Triggers in Property Classes ........................................................................... 106
6.4 Introduction to Visual Attributes .................................................................................... 106
6.5 Creating Named Visual Attribues .................................................................................. 108
6.6 Changing the visual attribute of an object at runtime ..................................................... 108
7 Form Objects .......................................................................................................................109
7.1 Editors............................................................................................................................. 109
7.2 Timers ............................................................................................................................. 112
7.3 List of Values (LOV) ...................................................................................................... 114
7.4 Alerts 121
8 Record Groups ....................................................................................................................124
8.1 About Recordgroups ....................................................................................................... 124
8.2 Types of Record Groups.................................................................................................124
8.3 Record Group Sources.................................................................................................... 125
8.4 Creating Record Groups .................................................................................................125
8.5 Using Record Groups ..................................................................................................... 128
9 Canvases & Windows .........................................................................................................131
9.1 Introduction .................................................................................................................... 131
9.2 Type of Canvas -Views ...................................................................................................131
9.3 Windows......................................................................................................................... 138
10 Object Groups .....................................................................................................................140
10.1 Introduction .................................................................................................................... 140
10.2 Creating an Object Group .............................................................................................. 140
10.3 Deleting objects from an object group ........................................................................... 141
10.4 Reusing the Object Group .............................................................................................. 141
11 Multiple Form Application................................................................................................145
11.1 Invoking Forms .............................................................................................................. 145
11.2 Open_Form..................................................................................................................... 145
11.3 CALL_FORM................................................................................................................ 147
11.4 NEW_FORM ................................................................................................................. 150
11.5 Closing Forms ................................................................................................................ 151
D2K For ms Builder

11.6 Parameters ...................................................................................................................... 152


11.7 Built-ins .......................................................................................................................... 155
12 Libraries...............................................................................................................................157
12.1 PL/SQL Libraries ........................................................................................................... 157
12.2 Object Libraries .............................................................................................................. 160
12.3 SmartTriggers................................................................................................................. 166
13 Menus ...................................................................................................................................167
13.1 Introduction .................................................................................................................... 167
13.2 Default Menu.................................................................................................................. 167
13.3 Custom Menu................................................................................................................. 167
13.4 The Menu Editor ............................................................................................................ 168
13.5 Creating A Menu Module .............................................................................................. 169
13.6 Types of Menu Items ...................................................................................................... 175
13.7 Assigning Commands to Menu Items ............................................................................ 176
13.8 Using PL/SQL Code in Menu Modules:........................................................................ 176
13.9 Toolbars.......................................................................................................................... 179
13.10 Referencing Objects in PL/SQL..................................................................................... 182
13.11 Attaching a Menu Module to a Form ............................................................................. 183
13.12 Adding Features to a Basic Menu .................................................................................. 185
13.13 Define Mnemonic keys and Keyboard Accelerators...................................................... 185
13.14 Creating a Tear-off Menu............................................................................................... 186
14 Product Integration.............................................................................................................187
14.1 Introduction .................................................................................................................... 187
14.2 Run_Product Built-in ..................................................................................................... 187
14.3 Using Integrated Wizards ............................................................................................... 189
15 Implementing ActiveX Control.........................................................................................192
15.1 Object Embedding and Automation ............................................................................... 192
15.2 Inserting an ActiveX control in a form module ............................................................. 195
15.3 About OLE activation styles .......................................................................................... 203
15.4 The registration database................................................................................................ 204
D2K For ms Builder

1 Introduction to Developer / 2000


1.1 Introduction to Client -Server Computing Model

The Client-Server Computing is important in the Information System Industry. This


section introduces the evolution from the Host -Based computing to the Client-Server
computing model.

Ø The Mainframe / Minicomputer computing model

In this Host-Based settings a 'Dumb Terminal' is physically connected to the


mainframe.

Dumb Terminal

A terminal that has no processing capability, which can only send information to
the central mainframe and display information given to it by that mainframe.

In these Host-Based settings the host carries out the application processing and
management of data, so the entire processing load rests on the mainframe only.

Ø The Disconnected PC computing model

These models are stand-alone machines with their own set of data and processing
capabilities. In the centralised host-based computing models the corporate
information was centralised and available to all employees, now it is distributed
among the mainframe and personal workstations. These machines allow removing
the overload from the mainframe but the data on PCs is not available to all users
who may need it. The disconnected personal workstation users cannot share the
expensive peripheral computer devices that mainframe users can share for e.g.
Printers, Modems, Disk Drives etc,

Ø The Network / File Server Computing model

The data and peripheral-Sharing problems gives birth to the Network /file Server
Computing model. A Network (LAN) lets a workgroup to continue reap the
benefits of easy-to-use PCs but also permits the workgroup to share the data and
peripherals as in a mainframe system. To share data in a LAN, users store files on
the 'File Server', which is a central node that stores data files where all users can
access them. In LAN, 'File Server' is an independent computer that can be best
specialised for its job by giving it lots of disk storage space. In LAN an
application running on the workstation reads and writes files on the LAN's File
Server.
D2K For ms Builder

There are two major flaws in a LAN Set-up:

1. Lack of Data Concurrency

For example in the multi-user application environment, if two users are accessing the
same file then in that case another user has to wait in line to access the same file. That's
because the file server operates in files, which are very large and prevents a user from
sharing a file when another user has it locked out.

2. If many workstations request and send many files in a LAN, the network can quickly
become saturated with traffic; which degrades the overall system performance.

Ø The Client-Server Computing Model

The problems of the LAN have led to the genesis of the Client-Server
Technology. The Client-Server computing is also called as Distributed
Application Processing or Co-operative Application Processing. In this kind of
set-up, the application runs on the user's PC / Workstations and accesses the
centrally maintained and managed Server.

1.1.1 Components of a Client-Server Model The Server

The Server

The Server or Back-End focuses on efficiently managing resources, such as a database of


information. Its primary job is to manage its resources optionally among multiple clients
that concurrently request the same resource from the server.

The Client

The client application or front-end application is the part of the system. In the Client-
Server application, the clients' main job is to request and retrieve information from the
server.

The Network

The Network and Communication software are the vehicles that transmit data between
the Clients and the Server in an Application System. Both the client and the server run
communication software that allows them to talk across a network.

1.1.2 Advantages of Client-Server Computing Model


D2K For ms Builder

A Client-Server system can deliver better performance than a File Server system. Client
application and a database server work together to split the processing load of an
application into atleast two parts, one of which requests things from the other. The
requester is the Client, 'and the provider is the Server. In this type of settings, the client
application works with small specific data sets such as rows in a table - not files, as in the
File Server system.

A database Server also provides the facility of row locking which ensures for the data
concurrency, as well as minimizes the network traffic, and improves system performance.

1.2 Introduction To Developer 2000


Oracle Developer 2000 is a front-end tool that is completely based on Window's (GUI)
Graphical User Interface. Developer 2000 provides you with all the tools you need to
develop robust, scaleable and fast applications in a Client/Server environment.

Developer/2000 consists of three distinct products

Forms 5.0 Reports 3.0 Graphics 3.0

1.3 Builders

Oracle Developer 2000 products (Forms 5.0, Reports 3.0, and Graphics 3.0) are also
called as Oracle Developer 2000 Builders. With the help of above Builders users can
develop applications.

Forms Builder

Reports Builder
D2K For ms Builder

Graphics Builder

1.3.1 Introducing Form Builder

Form Builder is a powerful development tool for building client/server applications.


Developers use Form Builder to create applications that provide end users access to
information stored in a database. End users operate Form Builder applications to retrieve,
enter, modify, and save information in the database.

To speed development and help you get started generating objects for your application,
Form Builder provides wizards. The wizards' application-generation capabilities leave
both new and experienced developers free to work on other aspects of a form module.

1.3.2 Overview of Reports 3.0

Oracle Reports 3.0 is used to produce reports from the data in the Oracle Database. With
Oracle Reports you can create reports in a wide variety of styles, including Tabular,
Master/Detail, Form, Form Letter, and Matrix.

1.3.3 Overview of Graphics 3.0

Oracle Graphics is component of Oracle Developer 2000 that is used to graphically


display the data. With Oracle Graphics we can create charts in a wide variety of styles
including column, bar, line, mixed, and pie. You build graphics applications in Oracle
Graphics by defining queries, selecting a chart type, editing the chart objects using the
layout editor and property sheets, and writing triggers using the program unit editor.

1.4 Hardware requirements for Developer 2000


Developer 2000 runs on an IBM-compatible Windows 3.x. This kind of PC requires at
least 16MB of RAM, which has additional permanent swap file of atleast 8MB to design
a new application modules. (It is possible to run most Oracle Developer 2000
applications on a smaller machine, but highly complex modules perform poorly on a
D2K For ms Builder

lesser system). To load all the tools with demos and on-line documentation requires
nearly 200MB of Hard Disk storage.

1.5 Common Features of Oracle Developer/2000 Products.


Ø Windows Interface
Ø Object Navigator
Ø Toolbars
Ø Property Palette
Ø PL/SQL Editors
Ø Help

1.5.1 Windows Interface

Developer 2000 uses all of the standard Windows interface elements like resizable
windows, pull-down menus, toolbars, point-and-click access, cut, copy, paste, dialog
boxes etc.

Common Menus and Menu Items seen on Oracle Developer/2000 Builders

1.5.2 Object Navigator

The Object Navigator provides the developer with a hierarchical view of the objects in
the application and in the database. It resembles the functional capabilities of Windows
File Manager. By selecting the items in the Object Navigator, the developer can view and
update the properties as well as the appearance of the object on the screen. The Object
Navigators are implemented in a consistent manner in the builders for Forms, Reports,
and Graphics.
D2K For ms Builder

Figure 1-1: The Object Navigator (Forms)

1.5.3 Toolbars

Each of the Developer 2000 designers, object Navigators have an iconic toolbar on the
left side, which provides point and click access to many commonly performed operations.

The following are the commonly performed items on the toolbars:

Button Usage

Open Invokes the Open dialog Box.


D2K For ms Builder

Save Invokes the Save dialog Box.

Run Runs the current application.

Create Creates an object of type selected.

Delete Deletes an object of type selected.

Expand Expands the current branch one level.

Collapse Collapses the current branch one level.

Expand All Expands all branches under the current node.

Collapse All Collapses all branches under the current node.

Oracle Forms, Reports and Graphics also have their own toolbar to support their Layout
editors.

Bubble Help is provided for all the iconic buttons for each tool bars within Oracle
Deve loper 2000.

1.5.4 Property Palette

Each Oracle Developer 2000 provides a property palette to review and modify the
properties of any object within the application. The properties are displayed in forms with
a property window.

1.5.5 PL/SQL Editors

The Oracle Develo per 2000 products incorporate the use of PL/SOL Editors. Each of the
Source code within an application can be incrementally compiled using the PLISOL
Editor. The current code can be immediately checked for syntax errors and also there is
no need to recompile the entire application at the end of the development process.

1.5.6 Help

The three products of the Oracle Developer 2000 provide the on-line help facility. The
menu Help can invoke help.
D2K For ms Builder

1.6 Features of Developer 2000


Developer 2000 supports the concept of (OOP) programming:-

Ø Inheritance
Ø Encapsulation
Ø Polymorphism

Based on selected activities called events, you can write triggers and program units to
define the process to be executed whenever the event occurs. Developer 2000 utilizes the
concept of (OOP) Object-Oriented Programming with object inheritance, reusability, and
data encapsulation, as well as modularity and polymorphism. These features enable the
developer to construct high-quality, critical application in a very short period of time.

Inheritance

Inheritance means a user can create any individual object, which is based on another
object's definition with its original property, as well as, it also allows user to modify the
property. Oracle Forms supports inheritance via the use of property classes.

Encapsulation

Encapsulation allows user to combine and hide data. Oracle Forms, Oracle Reports,
Oracle Graphics supports encapsulation by utilizing stored functions, procedures, and
packages.

Polymorphism

Polymorphism is the ability of individual objects to respond to a given method in their


own way. Oracle Forms supports Polymorphism via the use of object class trigger that
can fire at the form, block, or item level.
D2K For ms Builder

2 Introduction to Forms 5.0

2.1 Introduction to Forms 5.0

Oracle Forms 5.0 is a part of the Cooperative Development Environment Tools (CDE) of
Developer/2000 for building Client-Server applications. Oracle Forms 5.0 is used to
create form-based applications for entering, querying, updating, and deleting data. Instead
of writing programs, you define your application using simple menus, property windows,
and a powerful Wizard. Oracle Forms Builder also provides the capability to define
libraries of PL/SQL code that can be referenced from many forms application.

2.1.1 Components of Forms 5.0

Oracle Forms is a product that is supported by three primary components.

Forms Builder Forms Compiler Forms Runtime

Oracle Forms Builder

Form Builder is a development tool for building applications that provide users access to
information stored in a database. Form 'Builder modules can run standalone and they can
also have reports or graphics embedded in them.

When you build an application in the Forms Builder, a .FMB (Form Module Binary) file
gets created.

To run the application you need to Compile it first using the Forms Compiler Or in the
Preference Option Compile Before Run checkbox is set, so the Form is automatically
compiled before it is run.

Oracle Forms Compiler

Oracle Forms Compiler is used to generate the application built in the Forms Builder.
The Forms Compiler converts the 4GL created by the Builder into an executable file.
Compiling a form module compiles all of its code objects and creates a .FMX (Form
Module Executable) runfile. You will usually generate the executable from within the
Forms builder during the development process, prior to running the application for
testing.
D2K For ms Builder

Oracle Forms Runtime

Oracle Forms Runtime is the runform engine that uses the compiled version of the form.
Application developers use the Oracle Forms Builder to create an application, then use
the Oracle Forms Compiler component to generate an executable runfile and then use the
Oracle Forms Runtime component to run the compiled runfile.

After starting the Forms Builder the designing of an application is done through the
individual modules. You build applications in Oracle Forms by developing different
types of modules.

2.1.2 Form Builder Modules

The highest-level Form Builder objects are 'modules'. Each module consists of any
number of lower-level objects. When you work with Form Builder, you work wit h four
types of modules

Ø Form modules
Ø Menu modules
Ø Object library modules
Ø PL/SQL library modules

You combine various module types to create a complete application

The primary object of the Form Builder is the form.

Ø The Form Module

A form module is a collection of objects (such as windows, canvases, blocks, and items)
and data that users interact with, in order to modify database tables. They make up the
main body of a Form Builder application, and they contain any of the user interface items
as well as the data source definitions and behavior.

The Form Module allows the programmer to create forms to facilitate data manipulation
tasks, such as adding, reviewing, changing and removing data from the database. It
consists of objects and code routines. In a form module you can define objects like
windows, fields, check boxes etc.

Ø The Menu Module

The Menu Module allows the programmer to create Menus, which provides the user an
easy method of activating different tasks provided in the application.

It is a collection of menus and menu item commands that make up an application menu.
A menu may consist of a main menu object and multiple submenu objects.
D2K For ms Builder

Ø The PL/SQL Library Module

A library module is a collection of client-side code that can be shared across modules and
applications.

The PL/SQL Library Module allows the programmer to create libraries of reusable
PL/SQL programs, thus facilitating the task of application development.

It is a collection of user named functions, procedures and packages that can be called
from other module in the application.

Ø The Object Library Module

In Object Library module is a collection of objects like items, alerts, and editors. These
Objects can be reused resulting in uniformity in the application and rapid application
deve lopment.

2.2 Application Partitioning


Oracle Forms 5.0 supports Application Partitioning:

Ø The PL/SOL runtime system is a technology, not an independent product. It is an


engine that executes PL/SOL blocks and subprograms. The engine can be installed in
an Oracle Server or in an application development tools such as Forms 5.0, Reports
3.0, Graphics 3.0.

PL/SQL engine can reside in two environments:

The Oracle Server-Side The Client-Side


(Back-end) (Back-end)

Oracle toots contains the PL/SOL engine, an application development tool that can
process PL/SOL blocks. This tool passes the block to its local application site and sends
only SOL statements to Oracle back-end. Thus most of the work is done at the Client-
side, not at the server side, which gives better performance and flexibility, particularly
with many users of many applications using the database.

Ø A key facility of Client-Server computing is the ability to partition your


application between the client and Server. Using Developer 2000 with Oracle,
You cannot move the database access operations to the server, but you can move
chunks of your application code into database procedures or triggers.
D2K For ms Builder

Ø To Make the application partitioning even easier, Oracle Forms allows you to
drag-and-drop procedures between your application and the server in one simple
mouse operation.

Ø With drag-and-drop partitioning, you can quickly move procedures between your
application and. the server, without having to change any of the code in your
application.

2.3 Basic Operations

2.3.1 To start with Oracle Forms Builder

The Oracle Forms Builder is the design component of Oracle Form 5.0. From the Forms
builder you can build, generate and execute the form.

1. Click on Start button ->Programs -> Developer 2000 R 2.0 -> Forms Builder.

OR

Enter the following command at the system prompt


F50des32 [module name] [userid] [parameters]
[Userid] userid=userid/passwd.

Welcome Screen

When you start Form Builder the following wizard is displayed. This happens only when
you start the Form Builder.

Figure 2-1: Welcome Screen


D2K For ms Builder

Connecting to Oracle

In order to access database objects of the Oracle Database, User should get connected to
Oracle Database.

You can connect to ORACLE from the builder:

1. Select File -> Connect

The Connect dialog box appears.

Figure 2-2: Connect Dialog Box

2. Enter a valid username, password, and database connect string.

3. Click Connect.

It is possible to work in the Oracle Forms Builder without having to connect to the Back-
end. As soon as you fire a query or access any object of Oracle Database, it will request
you for a connection. Compiler or Runtime also requires the application to connect to the
Back-end.

Figure 2-3: Connection Request


D2K For ms Builder

2.4 Designer Interface

2.4.1 The Object Navigator

The Object Navigator provides a hierarchical display of the objects in all open modules.
Objects are grouped under the appropriate node. for ego All the windows defined in the
form module will appear only under Windows node. Objects and nodes in the object
navigator are displayed with the '+' or '.' symbol to indicate whether they are currently
expanded or collapsed. A grey '+' is displayed for a node that does not yet contain lower-
level objects. A round bullet is displayed in front of an object that cannot contain any
lower-level objects.

In the object Navigator the highest level nodes are displayed:-

Ø Forms
Ø Menus
Ø Libraries
Ø Packages
Ø Database objects

Figure 2-4: Object Navigator

Objects Under the Forms node

Ø Module

When the Builder Window displays Object Navigator Window you will see a default
module MODULE1 as the only form in the window.
This node by default displays 'Module 1, in the object navigator whenever user saves the
form, then module node gets changed by user specified name.
D2K For ms Builder

Ø Triggers

Triggers are PL/SQL Code that will be executed based on specific activity or condition in
the form. These activities are also called as events. Many of the trigger events will
perform a particular default function. A trigger can be written to disable, modify, or
enhance the default processing capabilities associated with the event. Triggers can be
defined at the Form, Item, Block or Record level. Details of trigger processing will be
covered in the chapter on Processes and Triggers.

Ø Alerts

Alerts are used to provide additional information or other messages that require response
or acknowledgement from the user. These are the message windows used to warn the
user of some application condition. An example Alert is given below.

Ø Attached Libraries

Libraries are special Oracle Forms Modules that can be defined to contain reusable
procedures and functions. By attaching program unit libraries to a form, the program
code can be maintained in a single file rather than in each individual form module.

Ø Blocks

A Block corresponds in a form to the individual entity (Table, or View) in the database.
Blocks may be created that does not correspond to any table, such blocks called as Non
Base table blocks. Non-base table blocks are used to hold generic control information.

Ø Items

An item corresponds to a single data element of field. These items may contain database
columns or may be used as containers for other related data.

Ø Relations

Relations node is used when user creates multiple blocks in a form. These blocks can be
related by using relation. For e.g . In a multiple blocks form, one block is usually defined
as the primary or master block, and the other blocks display the detail information
associated with the current record in the master block. Say, the Dept -Emp relationship in
which using Master-Detail relationship we can find out how many employees are
working in the same department.

Ø Canvas-View

Canvas- Views are background objects on which other objects or items are placed.
D2K For ms Builder

Ø Editors

An editor is a window for viewing and maintaining large data fields. These data fields are
sometimes included for the entry of user comments or other infor mation that would not
normally fit in a displayed item.

Figure 2-5: Editor

Ø LOVs (List of Values)

Lovs also called as List of Values provide the user with list of valid entries for a field. A
list of Values presents data contained within an object called a record group whereby the
user will select one value from the list to populate a form item. The list of values may
also be used to validate the user input to ensure that a valid value is entered.

Figure 2-6: List of Values

Ø Object Groups

An Object Group is a special mechanism for packaging several Form objects together. It
may then be used in other forms with a minimum of programming efforts. Once an object
group is created in a form, any of the form objects may be copied into the object group.
D2K For ms Builder

Ø Parameters

Parameters are used to pass values from one form to a newly called form in a multiple
form applications. Using parameters, values can also be passed via integration to various
developer 2000 products.

Ø Program Units

Program units are PL/SQL procedures and functions that can be called by the form
triggers. It is segment of program code that is used by more than one trigger.

Ø Property Classes

A Property Class defines' the properties of a class of objects. It is a collection of


properties that can be applied to objects having common property.

Ø Record Groups

Record Groups are the virtual tables in memory. Record groups are structured set of data
that can be used to pass data between application modules or to populate lists of values or
other list items.

Ø Visual Attributes

It is a collection of attributes with respect to color, font, and style of an object.

Ø Windows

A window is the frame within which a form appears on the user's screen. Each canvas is
assigned to the specific window in the form and several canvases may be assigned to the
same window. A single form can contain several windows or it may consist of only one
window.

The top-level nodes in the Object Navigator include Forms. Menus. Libraries. Object
Libraries. Built-in Packages and Database Objects All other nodes and the objects they
contain are indented to indicate that they belong to these higher-level nodes.

Each object in the Object Navigator is displayed with an icon that indicates its type. For
some objects double-clicking the icon invokes an editor appropriate to that type of object.
For example double-clicking the object icon for a canvas invokes the Layout Editor.

You can perform the following operations in the Object Navigator:

Ø expand and collapse entries to locate objects quickly


Ø select objects
D2K For ms Builder

Ø create and delete objects


Ø copy and move objects within and between modules

Object Navigator views

The Object Navigator can display modules in one of two views: Ownership (the default),
and Visual. The view determines which objects you see in the Object Navigator and how
those objects are arranged.

Ø Ownership View

In the ownership view, all form objects are visible, and the display hierarchy corresponds
to the form builder object ownership hierarchy: form-block—item, Items and relations
are owned by blocks; blocks are owned by forms; triggers can be owned by forms,
blocks, or items; all other form objects (windows, editors, record groups, etc.) are owned
by forms.

Ø Visual View

In the Visual view, only windows, canvases, and items are displayed. The Visual view
hierarchy corresponds to the hierarchy of objects in a form window: window-canvas-
item. Items are assigned to canvases; canvases are assigned to windows. Each window
can have multiple canvases, and there can be multiple items on a single canvas.

When the Object Navigator is in Ownership view, form items are listed under the blocks
to which they are assigned. When the Object Navigator is in Visual View, form items are
listed under the canvases on which they are displayed.

2.4.2 The Property Palette

The Property Palette enables you to set the properties of objects you create in form and
menu modules. When you select an object in an editor or in the Object Navigator, the
Property Palette updates to show the properties of that object. When you need to compare
the properties of two different objects, you can invoke additional Property Palettes as
needed. Tip: Use the Freeze icon in the horizontal tool bar, in the Property Sheet.
D2K For ms Builder

Figure 2-7: Property Palette

To invoke property palette:

1. First select the object and from the object navigator choose Tools -> property
palette menu item

OR

Right click on the object for which you want to display the property palette from
the Object Navigator or Layout editor from the popup menu select Property
Palette. (There are no properties associated with libraries. Attached libraries,
Program units.)
D2K For ms Builder

2.4.3 Data Block Wizard

The Data Block Wizard enables you to easily create or modify data blocks for use in your
application. The Data Block Wizard can be reentered after initial creation of the data
block, enabling you to modify an existing data block, even if it was not originally created
with the wizard.

2.4.4 The Layout Wizard

The Layout Wizard enables you to quickly layout the items of a data block. The wizard
displays the items in a frame on a canvas and lays them out in one of several layout
styles, after which you can manually alter the layout to your own specifications.

Functions of the Layout Editor

The following functions can be carried out in the Layout Editor:

Ø Resize the canvas and viewport


Ø Create, move and resize the items
Ø Invoke item property sheets
Ø Add boilerplate text and graphics to the canvas
Ø Set the font, color and font pattern attributes of the items and graphics
Ø Cut, copy and paste the items and graphics
Ø Import and export text, images and drawings to and from a canvas

Components of the Layout Editor

The Layout Editor consists of the following components:

Ø Workspace

Workspace is the area of Layout editor window where you create and manipulate items,
boilerplate text and graphics.

Ø Title Bar

The title bar displays the module, current canvas and current block.
D2K For ms Builder

Figure 2-8: Layout Editor

Figure 2-9: Tool Palette

Ø Rulers

The horizontal and vertical rulers at the top and left size of the Workspace provide a
reference for Sizing and arranging objects in the layout editor.

Ø Grid

There is a grid defined within the workspace that helps you position the objects.
D2K For ms Builder

2.4.5 Defining the Canvas-View

A canvases is a surface -inside a Window Container -on which you place the interface
items and boilerplate objects that end users interact With when they run the form. By
default, any canvas you create at runtime is assigned to the window named WINDOW1.
To explicitly associate a canvas to a specific window, set the canvas Window property
accordingly.

You specify the canvas you want to work in at the time of invoking the layout wizard. By
default new objects created are assigned to the current canvas. A canvas has an attribute
called viewport. The vie wport defines the area of the canvas, which is displayed in a
Window at runtime, called the view. The Position and size of viewport can be changed at
run-time.

Ø Canvas Operations

The operations that can be done on a canvas are showing and hiding the canva s, resizing
the canvas and setting visual attributes.

Ø Canvas types

Form Builder provides four types of canvases, all of which can be displayed in the same
window at runtime. A canvas' type defines how Form Builder will display it in the
window to which it is assigned. When you create a canvas, you specify its type by setting
the Canvas Type property. The four canvas types are:

1. Content
2. Stacked
3. Tab
4. Toolbar

(Canvases will be covered in chapter Canvases & Windows)

Importing Boilerplate Drawings and Images

You can import graphic objects and images from the database or the file system into the
layout editor. Oracle forms currently supports the following graphics formats:

Image Formats
Ø BMP
Ø TIFF
Ø JFIF
Ø ORACLE Format
Ø PICT
Ø PCX
D2K For ms Builder

2.4.6 The PL/SQL Editor

The PL/SOL editor is the place where user can, enter and compile the code objects. The
PL/SOL editor provides a common editing environment for code objects. The code
objects in Oracle Forms include triggers, subprograms, functions, procedures, and
packages. The PL/SOL editor is automatically invoked whenever you create a trigger or
program unit, and it supports incremental compilation of the source code. With
incremental compilation, user gets an immediate feedback on any errors you may have,
and the generation of the form's executable is much quicker.

Figure 2-10: PL/SQL Editor

The Type and object pull down at the top of the PL/SOL editor defines the current object
context. The Name pull-down lists all of the code objects defined in that context.

Type

Sets the context to a specific type of object. When the current module is a form. Type can
be set to trigger or program unit. When the current module is menu, type can be set to
Menu Start-up code, Menu item code, or program unit. When the current object is a
library. type is always program unit.

Object

Sets editor context to a specific object scope. When type is set to trigger, object scope can
be set to form by selecting Form level in the first poplist. To set editor context to a
particular block, select the name of the object poptist. To set editor context to an item,
select the block that contains the item in the first object poplist, then select the item in the
second poplist.

Name

Name option lists all of the code object defined in the current context. Selecting a code
object from the name poplist makes that object the current object in the editor. To display
D2K For ms Builder

a particular trigger, select it from the Name poplist.

PL/SQL Editor Commands

Ø Compile

Compiles the code in the source code field. The compiler detects syntax errors, and
references .to non-existent objects, procedures, and functions. When you compile
successfully then. in the status bar displays <Successfully Compiled>.

Ø New

Allows user to create new triggers or program unit.

Ø Delete

Deletes the current code object.

Ø Close

Closes the PL/SOL editor.

To invoke PL/SQL editor

1. Choose Programs -> PL/SQL editor from the menu


If the current selection is an object to which triggers can be attached (form, block,
or item), the code for the first trigger attached will be displayed.

If the current selection is not a code object to which triggers are attached, an
(LOV) List of trigger names are displayed from which you could make a
selection.
OR

2. From the object navigator or anywhere in the form, if user clicks the right button
then pop-up menu will be displayed, so user can choose PL/SQL Editor.

2.4.7 The Graphical Menu Editor

We have seen how to work with form modules in the Object Navigator and the Layout
Editor same way we can work with menu modules in the Object Navigator and the Menu
Editor. The Navigator and the Menu Editor synchronize when you select a menu or menu
Item. Using the Graphical Menu Editor, you can create pull-down menus quickly.
D2K For ms Builder

2.5 Introduction to forms interface items


In Oracle Forms items are the interface objects that display information to operators and
allow them to interact with your application. Oracle Forms supports nine types of
interface items that you can use to build your application's interface.

The interface items are as follows

Push Button
A rectangle with a text label or icon graphic inside.

Check Box
A text label with a graphic state indicator that displays the current value as either checked
or unchecked. Selecting a check box toggles it to the opposite state.

Radio Groups
A group of radio buttons, one of which is always selected.

Display item
A read-only text box whose value must be fetched or assigned programmatically.
Operators cannot navigate to a display item or edit text it contains.

List Item
A list of choice displayed as either a Poplist or drop list, a Tlist or list box, and a Combo
box. An example of how a list would appear during runtime.

Image Item
A bordered rectangular, that displays images fetched from the database or read in from
the file system

Chart Item
A bordered rectangular of any size, that displays a chart which is created by Oracle
Graphics. Operators cannot navigate or manipulate chart items.

Text Item
A single or multi-line text box, that displays a variety of datatypes, format masks, and
D2K For ms Builder

editing capabilities. They are usually mapped to columns in the database.

Sound Item
Sound items allow end users to play and record sound data while working in a Form
Builder application. Developers can set up sound items to allow end users to play, record,
and store sound data stored in a database column or in the file system.

OCX Controls
ActiveX controls, originally known as OLE controls or OCXs make use of both the
ActiveX and OLE technologies. An ActiveX control is a stand-alone software component
that provides a user interface and sends events to clients, all according to the standards
defined by COM. It is an OLE server application that is entirely embedded in an
application with OLE client capabilities.

Tab Canvas
A tab canvas – made up of one or more tab pages – allows you to group and display a
large amount of related information on a single, dynamic canvas object. Tab canvases are
displayed on top of a content canvas, partly obscuring it. Tab pages each display a subset
of the information displayed on the entire tab canvas.

Stacked Canvas
Stacked canvas are displayed in a window along with the window’s content canvas(es)
and any number of other stacked canvases.
D2K For ms Builder

3 Blocks and Form Items

3.1 Introduction to Blocks

3.1.1 Concepts

Blocks are logical containers that have no physical representation--only the items
contained in a block are visible in the application interface. Blocks provide simple
mechanism to group related items into a functional unit for storing, displaying and
manipulating records. Just as tables store the data in form of rows and columns in the
database, blocks consist of related items that store the item it contains. A form contains
one or more blocks. Each block can relate directly to a single da tabase or view. Each item
in a form (text item, image item, radio group, and so on) belongs to a block. However,
like other objects, blocks have properties, and can be created, copied and modified in the
Form Builder. The items in a block can be placed on difference canvas-views and can be
displayed in different windows. Windows and Canvases will be covered in detail in the
coming chapters.

3.1.2 Types of Blocks

There are two types of blocks

Data Block Control Block

Ø A Data Block is associated with a database table or view, or a set of stored


procedures. Most often, data blocks are based on a single database table. A data block
automatically includes the functionality to support querying, updating, inserting, and
deleting rows in the table to which the block corresponds.
Ø A Control Block has no association with a database table or view; its objects do not
relate to database columns.

Data Sources

A data block can be based on any of the following datasources:

1. Table
2. View
3. From clause (query datasource only)
D2K For ms Builder

4. Procedure
5. Transactional trigger

When deciding on a block datasource, consider:


Will the block be used only to query records; will the block be used to perform
INSERTS, UPDATES, and DELETES (DML); or will the block be used to perform both
query and DML?
A table is the most commonly used block datasource. Unless you have special needs, a
table is still the best choice for a block datasource.
You should also consider the functional restrictions for each datasource type. The table
below lists the restrictions of selecting the different datasources.

Datasource Allows Allows DML Allows Array Allows


Query (INSERTS, Processing Query by
UPDATES, and Example
DELETES
Table Yes Yes Yes Yes
View Yes yes (certain Join Yes Yes
views may not
allow DML)
FROM clause Yes No Yes (only for No
queried records)
Procedure Yes No (if your No (if your No
procedure uses a procedure uses a
ref cursor variable) table of records)
Transactional Yes Yes No (if your trigger No
trigger uses a table of
records)

Using Stored Procedure as a block datasource is a option not available in the earlier
versions. You base a datablock on a stored procedure when you want to:

1. Increase control and security.


2. Query and update multiple tables.
3. Perform complex computations.
4. Perform validation and dml on the server-side.
5. Encapsulate logic within a subprogram.
6. Reduce network traffic through array processing

A stored procedure returns data to a data block by using either a Ref Cursor or a table of
records.

Ref Cursor
A ref cursor is a pointer to a server-side cursor variable. It is analogous to a pointer if "C"
D2K For ms Builder

in that it is an address to a location in memory. The stored procedure returns (reference to


a cursor that is open and populated by a SELECT statement to be use (as a block data
source.

A stored procedure that uses a reference cursor can only be used as a query block data
source; it cannot be used for DML block data source. Using a ref cursor is idea for
queries that are dependent only on variations in SQL statements and not PL/SQL.

Table of Records
A table of records is a PL/SOL structure that resembles an array of records. ThE stored
procedure constructs the array and passes back the resulting set of records t_ be used as a
block data source.

Using a table of records is ideal for queries that are dependent on PL/SQL and SQL
Efficiency in terms of the savings on network traffic increases, because it takes a single
round trip (from client to server) to execute the stored procedure, and a single round trip
for all the records returned.

Whether to use a Ref Cursor or a Table of Records, consider that:

1. A stored procedure that uses a ref cursor can only be used as a query block
datasource
2. A stored procedure that uses a table of records can be used as both a query and
DML block datasource

3.1.3 Data Items and Control Items

Data items correspond to table columns within the database. By manipulating a data item
(a text item, for example), the operator can automatically affect data that is in the
database.
Control items do not have any association with the database. When the operator
manipulates a control item, data within the database is not affected unless you provide the
appropriate SOL statements. In general, you create control items not to modi_ database
data, but instead to allow the operator to perform common application functions, such as
navigating from one screen to another.

Usage of Control items

1. Control items are used to display totals, averages, and other summary information
calculated from values in base table items and database tables.
2. Through control items in the application, developer can accept inputs from the user,
but that is not stored in the database.
3. Control items can also be used to display "look-up values" i.e, database values
derived from a table, other than the base table of the block.
4. Push Buttons and chart items are always control items. Because these items do not
store values, and they cannot relate to columns in the database.
D2K For ms Builder

3.2 Form Builder Wizard


To speed development and help you get started generating objects for you application,
Form Builder provides wizards. The wizards' application-generation capabilities leave
both beginning and experienced developers free to work on other aspects of a form
module.

The Data Block Wizard and Layout Wizard are powerful tools that allow you to quickly
and easily complete the tasks of creating a data block (Using data block WizBrd) and
laying out its interface objects (Using Layout Wizard).

3.2.1 Data Block Wizard:

Ø Use the Data Block Wizard to:


Ø create or modify data blocks based on a table, a view, or a set of stored procedures
Ø map columns (from the data source) to items (in the data block)
Ø specify procedure arguments (if the data source is a stored procedure)
Ø create master-detail relationships between data blocks within a form module

3.2.2 Layout Wizard

Ø Use the Layout Wizard to:


Ø create or modify a layout frame and (if required) a canvas
Ø layout data block objects in the frame
Ø manipulate visual properties of objects in the frame
Ø specify both the look-and-feel and the layout options for the frame within a form
module

The first thing to do is start the development environment in which you build the Form.
Launch the Form Builder by clicking on Forms Builder icon. The Builder displays
Welcome dialog box.
D2K For ms Builder

Figure 3-1: Welcome Screen – Form Builder

Choose the Use the Data Block Wizard radio button.

Creating the Form:

1. Create the Emp data Block that displays a single record at a time.
2. Arrange the items
3. Save and run the application

3.3 Create A data block (Data Source Table)


Creating the Emp Block

1. In the Object Navigator, Select the Data Blocks node. Click -> Create Icon on the
toolbar
It brings up the New Data Block Dialog

Figure 3-2: New Data Block

2. Click on the Use the Data Block Wizard radio button.


OR
In the Object Navigator’s menu choose Tools -> Data Block Wizard menu to invoke a
D2K For ms Builder

wizard that guides you through the process of building a data block.

Figure 3-3: Data Block Wizard : Welcome Page

3. Click Next to display the Type Page


D2K For ms Builder

Figure 3-4: Data Block Wizard – Type Page

4. On the Type page, click a radio button to specify a type: either Table or View, or
Stored Procedure. Click Next to select the datasource.

Figure 3-5: Data Block Wizard – Table Page


D2K For ms Builder

If you have selected:

Ø Table or View - In the Data Block Wizard --Type Page, you select the table or the
table and view from the database, thereafter map columns from the table or view to
items in the data block.

Ø Stored Procedure - In the Data Block Wizard --Type Page, you select stored
procedures to query, insert, update, delete, and lock data for the data block.

In Table/View field name Enter the name of the table or view to which the block is
associated.

If you are not connected to a database, the wizard displays the Connect dialog.

If you wish to select a table or view from a list of available tables and views in your
database schema (or all available schemas), click Browse, which asks what kind of tables
you want to see. Default is to see Tables of current user. You can see the tables of other
users to which you have access, you may want to see views, synonyms.

Figure 3-6: Tables Dialog


If you want the wizard to automatically enforce integrity constraints defined in the
database, check the Enforce Data Integrity checkbox.

Integrity Constraints

This option determines whether Oracle Forms should create a block, which enforces the
table and column constraints. This option is valid only for base-table blocks and not for
control blocks.
D2K For ms Builder

If this option is set to true then, Oracle Forms does the following:-

Ø Sets the Primary Key property to True and the Update Allowed property to False for
items that correspond to primary key columns, and sets the Primary Key property On
for the block.

Ø Creates a When-Validate-Item or When-Validate-Record trigger to enforce unique


values in items that correspond to primary key columns and to enforce CHECK
constraints. (When-Validate-Record is used when there is a composite primary key.)

Ø Creates a Key-Delrec trigger for the block if its base table is defined in the database
as having a primary-foreign key relationship with another table. The trigger prevents
the deletion of a record when there are corresponding detail records in the foreign key
table.

Ø Sets the Default property for items that correspond to columns having default value
constraints.

Available Columns and Database Items List

Click on refresh button to see all the Available Columns, the columns from the Emp
Table. Using the >(moves only the selected column) and »(moves all the column present
in the available columns) buttons, you can move the columns into the database items list
from the list of available items. E.g. If you want empno column, click on the empno
column to select it, then click on the> button to move it into the list or Database item. To
move back the columns from the database item to available Columns (In case the desired
column earlier present in the block no longer needed) click the < and «buttons.

5. Click on Next to display data Block Wizard: Finish Page


D2K For ms Builder

Figure 3-7: Data Block wizard – Finish Page

6. Having finished creating the data block, you now have two choices:

Ø Exit the Data Block Wizard and immediately invoke the Layout Wizard
(where you can layout the items of the data block in a frame on a canvas).
Ø Just exit the Data Block Wizard

If you choose to invoke the Layout Wizard, the wizard will walk you through the
steps of:

1. Selecting a canvas on which to display your data block items, specifying whit items
to display in the layout,
2. Selecting prompts (Each interface control can have a prompt associated with it. A
prompt is the text label that appears beside and height / width for the items, creating a
frame (including style and title) in which to display the items, and choosing the
number of records to display in the frame (will be explained later in this chapter) and
the distance between those records. Using the Layout Wizard to layout the items of
your data block automates all tasks required to create the basic layout.

If you choose to simply exit the Data Block Wizard without. invoking the Layout
Wizard, you have two choices:

1. Manually layout the data block items.


2. Invoke the Layout Wizard at a later time.
To manually layout the items of your data block, you must
D2K For ms Builder

Ø Create a canvas, (Canvas is a surface -inside a window that serve as


placeholders for all data items, controls, text labels that users see in the
application
Ø Create frames (Frame groups the set of items you are displaying on .the
canvas) on that canvas (optional),
Ø Place Items inside the frames or just on the canvas, and arrange all the items
on the frame or canvas
To invoke the Layout Wizard later, simply select the data block's frame in the Object
Navigator (under the Canvases node) or Layout Editor, and choose Tools Layout
Wizard from the menu.
Ø Click on Finish button Brings up Layout Wizard Welcome Page

Layout Wizard

1. Click Next displays Layout Wizard: Canvas Page

Figure 3-8: Layout Wizard : Canvas Page

To select a canvas:

1. On the Canvas page, select a canvas name from the Canvas poplist.
You can select an existing canvas, or create a new canvas.
2. If you select (New Canvas), select a canvas type from the Type poplist.
If you select Tab from the Type poplist, you also must specify a tab page from the
Tab Page poplist.
D2K For ms Builder

The Canvas page is not available in the re-entrant Layout Wizard; to move a frame to
another canvas, use the Layout Editor to cut and paste the frame to the new canvas.
3. Click Next displays Layout Wizard: Data Block Page.

Figure 3-9: Layout Wizard – Data Block Page

To display data block items in the frame

1. On the Data Block page, select a block from the Data Block poplist.
If you accessed the Layout Wizard directly from the Data Block Wizard, the Data
Block poplist is disabled
2. Select the data block item(s) from the Available Items list that you wish to display in
the frame
When you move an item from the Available Items list to the Displayed Items list, the
wizard places the item on the frame's canvas and sets its Displayed property to Yes
3. For each item you move to the Displayed Items list, use the Item Type poplist to
specify a datatype
If the item is a radio group, select the item in the Displayed Items list, then use the
View poplist to change the wizard's focus (from the radio group itself to the radio
buttons that comprise the group). That way you can reorder the radio buttons, or set
the prompt, width or height of a radio button (on the Items page).
(Radio Groups & Radio Buttons is covered later in this Chapter)
After moving the items to Displayed pop-list
4. Click Next displays Layout Wizard : Items Page
D2K For ms Builder

Figure 3-10: Layout Wizard – Items Page

To set item prompt, width and height

On the Items page, specify prompt text, width, and height for each item displayed in the
frame's layout.

A prompt is a textual label that is physically attached to an item. If you update the layout
the data block items in the Layout Editor, moving an item also will move its prompt.

To create a prompt

1. In the Layout Editor, double-click the desired item to display the Property Palette.
2. Under the Prompt node, type the desired text label in the Prompt property field.
3. Click Next displays Layout Wizard : Style Page
D2K For ms Builder

Figure 3-11: Layout Wizard – Style Page

To select a layout style for the frame

On the Style page, click a radio button to choose between a form layout and a tabular
layout.

4. Click Next displays Layout Wizard : Rows Page


D2K For ms Builder

Figure 3-12: Layout Wizard : Rows Page

To set frame title and record properties

Frame
A frame is a graphic object that appears on a canvas. You use frames to arrange items
within a block. A frame is an object with properties. When you associate a frame with a
block the items in the block are automatically arranged within the frame. Each frame can
be associated with a block.

To display the Property Palette for the frame object; double click on the selected frame;
or right click on the selected frame to see the popup menu and click on property palette or
you can choose Tools - > Property Palette from main menu.

Tip:
If the line on the frame is not to be displayed find the line color tool at the bottom of the
tool palette and click on it. Click on "No Line" tool.
1. On the Rows page, enter the title you wish to display at the top of the frame in the
Title field.
2. In the Records Displayed field, enter the number of records you wish to display in the
frame (the default is 1).
If the layout style of the frame is:
Form – common when the data block is a master block – set the number of displayed
records to 1.
Tabular – common when the data block is a detail block – adjust the number of
displayed records to display the desired number of detail records.
D2K For ms Builder

3. In the Distance Between Records field, enter the physical distance (measured in the
form's coordinate system units) with which to separate the records displayed in the
frame.
4. To display a scrollbar adjacent to the frame (both at design-time and runtime), set the
Display Scroll bar check box to checked. Scrollbars are typically useful for multi-
record.
5. Click Next displays Layout Wizard : Finish Page

Having finished laying out the items of the data block in a frame, you are ready to exit
the Layout Wizard and continue work on the application. When you click Finish, the
wizard will close the Layout Wizard, and automatically display the layout of your frame
in the Layout Editor one of Form Builder's design tools.

The Layout Wizard is re -entrant

A powerful quality of the Layout Wizard is its ability to operate in re-entrant mode. This
means you can use the Layout Wizard to modify the layout of an existing frame-even if
the frame was not originally created with the Layout Wizard.
To invoke the Layout Wizard in re-entrant mode, select the block or the existing frame in
the Object Navigator (under the Canvases node) or Layout Editor and choose Tools ->
Layout Wizard.

3.4 Create a data block (Stored Procedure)


1. Start the Data Block Wizard
2. The Type Page is displayed
On the Type page, click a radio button to specify a type: Stored Procedure.
3. Next you select stored procedure to query, insert, update, delete, and lock data for the
data block.
D2K For ms Builder

Figure 3-13: Data Block Wizard – Type Page

To select a stored procedure as the data source for your data block, you must specify an
individual procedure for querying records for the data block. You also can specify
procedures for inserting, updating, deleting, and locking records. The Data Block Wizard
provides a page for each of the above functions.

4. Click Next to display query page


D2K For ms Builder

Figure 3-14: DataBlock wizard – Query Page

On the Query page, in the Procedure field, enter the name of the procedure that will
retrieve information for the data block, and click Refresh. If you are not connected to a
database, the wizard displays the Connect dialog. To map a column or columns from the
stored procedure to a database item in the data block.

Ø Select the column(s) and:


Ø Click '>' to move the selected column(s) from the 'Available Columns list to the
Database Items list (to move all available columns, click '»').
Ø To specify a value for an argument, enter it in the Value field.

5. Click next to display the Insert Page

To select an INSERT procedure:

Ø On the Insert page, in the Procedure field, enter the name of the procedure that will
insert information for the data block, and click Refresh.
Ø To specify a value for an argument, enter it in the Value field.
D2K For ms Builder

Figure 3-15: DataBlock Wizard Insert Page

6. Click Next to display Update Page

To select an UPDATE procedure:


Ø On the Update page, in the Procedure field, enter the name of the procedure that will
update information for the data block and click Refresh.
Ø To specify a value for an argument, enter it in the Value field.
D2K For ms Builder

Figure 3-16: DataBlock Wizard – Update Page

7. Click Next to display Delete Page

To select a DELETE procedure:


Ø On the Delete page, in the Procedure field, enter the name of the procedure that will
delete information for the data block, and click Refresh.
Ø To specify a value for an argument, enter it in the Value field.
D2K For ms Builder

Figure 3-17: DataBlock wizard – Delete Page

8. Click Next to display lock Page.


To select a LOCK procedure:
Ø On the Lock page, in the Procedure field, enter the name of the procedure that will
lock data for the data block, and click Refresh.
Ø To specify a value for an argument, enter it in the Value field
D2K For ms Builder

Figure 3-18: DataBlock wizard – Lock Page

After data block creation you can either

Ø Exit the Data Block Wizard and immediately invoke the Layout Wizard (where you
can layout the items of the data block in a frame on a canvas) OR

Ø Just exit the Data Block Wizard

If you choose to invoke the Layout Wizard, the wizard will walk you through the steps of
selecting a canvas on which to display your data block items, specifying which items to
display in the layout.

It is not compulsory to add all the procedures. Attach only those procedures that are
required by your application.

You can now Run the Form.

3.5 To create a control block


1. In the Object Navigator, click the Data Blocks node
Click the Create button in the toolbar
2. In the New Data Block dialog, choose Build a New Data Block Manually and click
OK.
D2K For ms Builder

3. Double-click the Block object icon to invoke the Property Palette


4. Under the General node, click the Name property, then type a name or accept the
default name.

The following chapter will cover how to create a master – detail block.

3.6 Creating Form Items


Once you create base table or control block, you can create items in that block at any
time. Before you create an item, you need to decide which block you want the item to be
in, and whether the item will be a base table or a control item.

Items are the most basic also most important- elements of an application's interface. They
are a bridge between the back-end and the front-end. Based on the way the data is
presented to users in a GUI environment items can be classified as data entry items and
GUI controls. Data Entry Items include text and display items. GUI controls include push
buttons, radio buttons, check boxes and list boxes, additionally image items, OCX
controls and OLE.

3.6.1 Push Buttons

Push button is an interface item, which can be placed on any block. This interface item is
used to initiate action such as Navigation, Save a form, Exit a form, Close a window,
display an alert etc. It does not store a value of its own and hence has no datatype. There
are two kinds of Push Buttons (based on appearance)

Text Iconic

These buttons will display the text or the label of the button clearly indicating their
functionality e.g. Help, Cancel.

Iconic Button

Contain an icon instead of a label. The icon graphically represents the functionality of the
button - used mainly in toolbars
D2K For ms Builder

Property Settings for the Text Push Button

Name : < Name of the Item>


Item Type : Button
Canvas : < Name of the canvas on which it should be placed>
Label : < Text string that will appear on the object>
Navigable : True.
Mouse Navigate : False.

Mouse Navigate property is to specify whether a mouse click in the item should cause
Oracle Forms to set focus to the item. The Mouse Navigate property applies only to GUI
applications. By default this property is True, when user activates the item with the
mouse, Oracle Forms performs the navigation to the item and moves the input focus to
the item. So if user has written When-Sutton-Pressed trigger on the item, it will never get
fired.

Do not forget to change the 'Mouse Navigate Property' as false because, when user
activates the item with the mouse, Oracle Forms does not perform navigation to move to
the item and the associated trigger will get fired.

Property Settings for the Iconic Push Button

Name : < Name of the Item>


Item Type : Button
Canvas : < Name of the canvas on which it should be placed>
Label : < Text string that will appear in the bubble help>
Navigable : True.
Mouse Navigate : False.
Iconic : True
Icon FileName : < Name of the .ico file without path>

On MS Windows, the lookup path for icon files is defined by the TK21_ICON
environment variable .in the ORACLE.lNI file. When you enter the name of the icon file
in the 'Icon Name_property', do not include the path or .ICO file extension.

Triggers associated with push buttons

When-Button-Pressed

Ø Fires when End users select a button by clicking it with the mouse, or select a button
by navigating to it and pressing [Select]. The cursor remains in the button unless the
button command moves it to a different item.

Ø Can be defined at form, block or item.


D2K For ms Builder

Ø Oracle Forms provides the interface event trigger called 'When-Button-Pressed' for
push buttons to execute a command or to initiate an action. When an operator selects
the button, Oracle Forms executes the code in the When-Button-Pressed trigger.

Ø To attach this trigger keep the item selected and invoke the PUSQL editor by right
click for pop-up menu or by choosing Programs->PUSQL Editor from the object
Navigator.

Ø From the drop-down list, select the When-Mouse-Pressed trigger.

Ø The following example shows the code written for the Exit (Iconic Push Button):-

Begin

Do_Key(‘Exit_Form’);
End;

Ø Compile the code, and run the form.

Ø Do_Key is the built -in restricted procedure, (which accepts the built-in subprogram),
that executes the key-trigger, which corresponds to the specified built-in
subprograms.

3.6.2 Check Boxes

A check box is a two-state control indicating whether a certain condition is True or False,
On or Off, Checked or Unchecked. When you define a check box, you must specify
which value you want the check box to represent as checked and which value you want it
to represent as unchecked. Operators toggle between the state of a checkbox. Check
boxes store characters, Numbers, and Date values.

The value of the check box can be set by,

Ø A fetch from a corresponding database column or,


Ø By operator input via item manipulation or,
Ø Through default value

Similarly the value of a check box can be committed to the database through standard
commit processing.

You create a check box by:

Converting the Item Type property of an existing item to Check Box

Create the item from scratch in the a Layout editor by selecting the checkbox icon from
the toolbar.
D2K For ms Builder

Property Settings of a Check Box

Name : < Name of the Item>


Item Type : Check Box
Canvas : < Name of the canvas on which it should be
placed>
Default Value : < Checked / Unchecked>
Label : <Text string that will appear on the object>
Value when Checked : The value that you would want to represent as
checked
Value when Unchecked : The value that you would want to represent as
Unchecked
Other Values : Discussed Below

Other Value Treatment


When you define a check box, you must specify how you want to handle any fetched or
assigned value that is not one of the values represented by the Checked or Unchecked
states. (Other value indicates the value, which is not defined by checked or unchecked
value).

There are three ways in which you could specify Other Values.

Reject Other Values Display it as a Display it as a


as Invalid Checked Value Unchecked Value

If Other Value is not specified then Default value must be given.

Triggers associated with the checkbox

When-CheckBox-Changed
This trigger fires when the operator changes the state of the Check Box.

Built-in associated with the checkbox

Built-ins :

Checkbox_checked
Return Value:
Boolean
D2K For ms Builder

3.6.3 Radio Groups and Radio Buttons

Radio group is an interface control consisting of a group of buttons of which only one is
selected (mutually exclusive). When you create a radio group, you associate a value with
each radio button. A radio group can include any number of radio buttons. Operators can
select a different button by clicking with the mouse. When you select anyone button from
the group, another gets deselected. User can select only one button at runtime. When you
create a radio group you associate a specific data value with each radio button in the
group. When an operator selects a radio button, the value of the radio group changes to
the value that you associated with the selected button. Radio buttons make up the gr oup.

To create a Radio Group

Example

In the given example we are creating a radio group for job item of emp table. This can be
done in two ways:

1. In the Layout Wizard after moving the Available Items to Displayed items. Select the
item whose Item Type you want to change (in our e.g. item job). From the Item Type
list select radio group.

In the Object Navigator select the Property Palette of the item whose Item type you
want to change. Under the Item Type Property from the pull-down select Radio
Group. In the Default value property enter MANAGER. Close Property Palette to
return to Object Navigator.

You now see the Radio Buttons heading under this item as seen in the figure below.

Figure 3-19: Radio Group and Radio Buttons in Object Navigator


D2K For ms Builder

Double-click on the radio buttons node Open the property sheet of the radio button and
set the following property.

If your block has 'record displayed property' for 5 records then set 'item displayed Displa
property' of the radio group as '1', else you will see 5 radio buttons.

Property settings for a Radio Button

Name : <Name of the button> RB_PRESIDENT


Label : < Text string that will appear besides the button>
PRESIDENT
Value : <The value fetched from the database or assigned to the
Radio group at runtime.> PRESIDENT
Default Value : <Name of any valid Radio button> (assumed other buttons
are created) RB_SALESMAN
Other Value : (Discussed below) CLERK

Other Values

A radio group can store a fetched or assigned value that it is not one of the values that
you associated with a specific radio button in the group. When you create a radio group,
you must specify how you want it to handle such other values.

It can be done in one of two ways:

It should reject Specify which element (button) of the


Other Values as group. It should highlight when value is
invalid other value
Built-Ins associated with the radio group
Get_Radio_Button_Property()

Syntax:

GetRadio_Button_Property (item_id ITEM, button_name VARCHAR2, property


NUMBER);
SetRadio_Button_Property()

Syntax:
Set_Radio_Button_Property (itemid ITEM, button_name VARCHAR2,
Property NUMBER, value NUMBER);

Possible properties that can be used with the above built-ins:-


D2K For ms Builder

Displayed : (True/False)
Enabled : (True/False)
Height : Character value in points
Label : Label Name
x_pos : x position in points
y_pos : y position in points

Triggers associated with the Radio Group

When-Radio-Changed

This trigger fires when an operator selects a different button in a Radio Group.

Example

Whenever user clicks on the ‘CLERK’ radio button it will be disabled at runtime

begin
if :emp. job = 'CLERK' then
Set_Radio_Button_Property('emp.job', 'CLERK', ENABLED, Property_false);
end if;
end;

3.6.4 Display Items

Display items are similar to the text item, but they store only fetched or assigned values.
They are non-naviga ble items, meaning we cannot edit their values at runtime. They are
used to display non-enterable totals, company logos. Company Names, Title column and
text labels for column values.

How to create a display item

In the Object Navigator, create a display item. To create a display item, select the block
where you want to insert the display item, then select the Item node, and the choose
Navigator->Create.

Tip:

You can also create display items by drawing them on a canvas in the Layout Editor by
selecting the display item icon from the tool palette.

An existing item's item type can be changed from existing type to Display Item in the
Property Palette.
D2K For ms Builder

Calculated Items

A common task in creating a form is to create an item that represents some calculated
value. E.g. You could combine several database items into a concatenated string in a
separate item that doesn’t correspond to a column in the base table. Another common
example is the Total field that sums the record in a block. An amount field calculated as
Quantity multiplied by Rate.

Use the Calculation Property group. Create a display item not a base table by setting the
item property Database Item to No. Fill in the properties in the Calculation Group Setting
Calculation mode to Formula turns on the Calculation feature.

Enter the formula:

Emp.Sal + NVL(:Emp.comm.,0)

Whenever any changes occur in the record, Developer /2000 recalculates the field and
displays the new value.

For totals :

Use Summary Calculation items. Set Pre-Compute summaries property in the Advanced
Database group for that block to Yes which tells Developer/2000 to calculate the
summary before it does a query.

Tip
Set the Total items property Number Of Items Displayed to 1.(usually it is zero meaning
the same number of items as records displayed in the block). Because you are
aggregating, the block displays multiple records ,you however do not want to display one
total for each record.

3.6.5 Text Item


A Text Item is an item in which the user can enter single line or multi-line text.

Creating Text Item

In the Object Navigator, highlight the items node and choose Navigator -> Create a Text
Item is created by default.

Go to the Property Palette of the item and set the canvas property to the desired canvas.
OR
In the Layout Editor, click on the following icon from the tool Palette.
Click in the Layout Editor where you want to place the Text Item.
You can go to the Property Palette of these items to set the different properties. Some of
the property settings have been explained below.
D2K For ms Builder

Property Value
Required Setting the Required property to ‘True’ will compel the user to
enter the value in it.
Format Mask Sets up a mask for the data to be displayed.
Multi-line You can set the multi-line property to True. The Multi-line property
determines whether a text item displays a single line of text or
multiple lines of text. A multi-line text item stores multiple lines of
text by wrapping text to the next line.
Vertical Scroll Bar Setting it to true will attach a scroll bar to the multi-line item.

The Format mask property is used to display data according to certain pre-defined
pattern. Some of them have been discussed below.

1. In case of amount fields, if you want to enter only the digits but display it
business format, then you can set the format mask to $999,999.99PR. Now if you
enter 1000.10 then it will be displayed as $1000.10. If -1000.10 is entered it, will
be displayed as <$1000.10>
2. If you want to embed characters inside a numeric string, you can enclose them in
double quotes in the format mask setting. Say if you want your output to be like
(022) 6187034, then you can specify it in your format mask as "("999")" 9999999
TO save the user the trouble of entering the extra characters like '(', set the format
mask to FM"("999")"9999999. so that the user enters only the digits.

Built-Ins associated with Text Items:

Display_Item

Syntax

Display_ltem(item_id, attribute);
Display_ltem(item_name, attribute);

This built-in can be used to modify an item's appearance by assigning a specified display
or visual attribute to the item. Whenever an item is created Oracle Form assigns a unique
id to that item. To refer to that item you can use its name as well as item id. So the first
parameter to the above built-in is either the item id or the item name. The second
parameter is the name of the visual attribute. This visual. Attribute will modify the
display properties of the text item.

DISPLAY_ITEM only affects the display of the current instance of the item; other
instances of the specified item are not affected.
D2K For ms Builder

Get_Item_Property

Syntax:

Get_ltem_Property(item_id, property);
Get_Item_Property(item_name, property);

It is used to get the current value of the given property for the item. The first parameter
refers to the item, whereas the second property refers to the property of the item you want
to know the property settings for the Required property, you can Get_ltem_Property
('Empno' . Required).

Set_Item_Property

Syntax

Set_Item_Property(item_id, property,value);
Set_Item_Property(item_name, property,value);

It is used to set the properties of an item programmatically. The second parameter refers
to the property name, which you want to set, whereas the value refers to the value to
which you have to set the property to.

In some cases you may be bale to get – but not set – certain object properties.

3.6.6 List Items ( Hard – coded Lists)

A list item is a list of elements of text type that can be displayed as a poplist, text list or a
combo box. A list item displays a fixed number of elements maximum of 30 Characters
long. Selecting a different element in a list deselects the previously selected elements.
Values for every list elements can be populated either at design time or dynamically at
runtime.

There are 3 styles for List Items

POP LIST TEXT LIST COMBO LIST


Ø Pop List
Pop list appears as a single field. When the operator clicks on the list icon; a drop down
list is displayed. User input is not allowed. User has to select from the available values in
the list.
D2K For ms Builder

Ø Text List
Text List appears as a rectangular box. It displays fixed values (Scro1Iable). Does not
allow user input. User has to select from the available values in the list.

Ø Combo List
Combo List appears as a single field. When the user clicks on the list item, a drop down
list is displayed. It allows for user input apart from selection from the list like poplist but
allows user input.

List Elements Value

All of these lists display a list of text items in some way. These strings are not necessarily
the value for the item. The list transforms what you see on the screen – a label, into an
actual value in the item, and it's that value that Forms stores in the database. Because of
this level of indirection between the label and value you can use the text for display and
some other datatype for the field.

E.g.
In the database the grade field is stored as number but the list displays text i.e. Clerk
stands for Grade 4; Salesman stands for Grade 3; Officer stands for Grade 2: Manager'
stands for Grade 1 It also translates the 1 when you query the record from the database,
displaying "Manager" instead.

Other Values

A list item can also store a fetched or assigned value that is not one of the value
associated with a specific element in the list.
When you define a list item, you must specify how you want it to handle such Other
Values.

This can be done in one of the two ways

Reject other values as not allowed Specify which element in the list is to
be highlighted when the value of the
list item is an Other value

In case of other list item user has to specify the default value or other value: But in case
of combo box list items accept operator-entered data, so you do not have to define an
Other value for combo box list items. The default value specifies the initial value of the
list item.
D2K For ms Builder

How to create the list item

You can create a list item from the existing 'text item' by changing its 'Item Type
Property' to list item, through Object Navigator. Layout Wizard or Layout Editor.

Through object navigator we can also insert any item and change it to list item (Use
Property Palette) or you can create list items by drawing them on a canvas in the layout
editor.

In the Layout Wizard- Data block Page after moving the available items to database items
from the Item Type pull down select list item.

Set the List Style to one of the three types of list.

A hard-coded list is a list that you fully specify in the designer. You fill out a dialog box
with the label, and their corresponding values, which become part of the client-side
application, the advantages of this approach are simplicity and speed because you can
create the list very quickly and the list is in the memory when you open the application.
The disadvantage is that you cannot change the list without regenerating the application.

Use hard-coded list for simple lists that don’t change.

1. Select the property palette of the list item. Under the Functional node select
Elements in list pr operty Click More... Button. .
OR
Double Click Elements in list Property, you see the List item Elements dialog
box.

Figure 3-20: List Items Elements


D2K For ms Builder

List Elements popup contains the label that will appear during runtime. In List Elements,
type the label that appears during runtime.

In the List Item Value popup type the value that needs to be stored in the database.

e.g. The list should display Manager, Salesman, Clerk in the pull down when the user
clicks on the pulldown in item job.

Enter the labels and corresponding values. If you want the value to be NULL, leave the
value cell blank. Use the down arrow or mouse to move to a new item in the list.

Use Ctrl + < (use Shift) key to delete the list item you have currently selected.

Triggers associated with list item

When-List-Changed
This trigger is used for Poplist and Combo List

When-List-Activated
This trigger is used with only Tlist. (dclick)

3.6.7 Image Items

Image items allow you to integrate images or pictures into your applications. Image item
is a bordered rectangle of any size that can be used to store and display images fetched
from the database or the file system. They can display images of different formats
(.Bmp,.Tiff etc.). Image items can be mapped to columns in the database or read from the
file system. Image items are dynamic and can change with records being displayed.

You can include two types of images into a Forms Builder application:

Ø Graphic objects
Ø Image items

Graphic Objects
Graphic Objects are static images: Users cannot navigate to these items at runtime. They
have to be imported from file system or database. Other items can be placed on the top of
these images. When the form module is saved the image is incorporated into the form
module. These items can be used to display logos and maps.

Image Items
These are dynamic image Items. Users can navigate to them at runtime. It has to be
imported from filesystem or database. They can be related to the column of a base table
or a control item. Only the definition of the image is stored as a. part of the Form module.
It is populated only at runtime.
D2K For ms Builder

Images and drawings are always stored in the database in Oracle Format. Thus, if you
execute READ _IMAGE_FilE to populate an image item with a BMP file and then issue
a commit. Oracle Forms inserts the im~ge in the corresponding LONG RAW column in
Oracle Format.

How to import a Graphic Object

In the Layout Editor, choose File -> Import -> Image

Figure 3-21: Import graphic object

How to create the Image item

1. Create a new item in the Object Navigator (a text item is created by default). Go
to the Property Palette of the item and change the item type to image.
2. Set the image item’s display appearance by using the Properties window. There is
no Datatype property for Image items. The datatype is predefined as Long Raw.

Populating Image Items

You can populate the image items with image in two ways:

1. You can fetch it from the database if it has been stored in the database (You can
have a table which has a column of type Long Raw)

You can simply execute the query and the image item will be populated by the
corresponding item in the database. You can also modify or change the image and
then save the changes. The modified image is stored in the corresponding Long
Raw column in the database.

2. You can also execute the Read_image_file built-in to populate the image item
with a image from the Filesystem.

Syntax

Read_image_file (Filename, Filetype, Item_id)


Read_image_file (Filename, Filetype, Item_name)
D2K For ms Builder

Filename : Indicates the name of the file in which the image should be stored
Filetype : Indicates the type of the file
Item_id : The id of the image item
Item_name : The name of image item in char

You cannot write a SELECT statement to select a LONG RAW value INTO an image
item.

Built-ins
Read_Image_File (as explained above)
Write_Image_File
Used to write the contents of an image item to a file.

Syntax
Write_Image_File(file_name VARCHAR2, file_type VARCHAR2, item_id item,
compression_quality NUMBER, image_depth NUMBER);

Write_Image_File(file_name VARCHAR2, file_type VARCHAR2, item_name


VARCHAR2, compression_quality NUMBER, image_depth NUMBER);

Filename : Indicates the name of the file in which the image should be stored
Filetype : Indicates the type of the file
Item_id : The id of the image item. Use the FIND_ITEM built -in to return the ID
to an appropriately typed variable. Datatype is ITEM
Item_name : The name of image item in char

Compression Quality
(optional) : The degree of depth Form Builder will apply to the image when it stores
it to the file. Datatype is VARCHAR2.

Image_depth
(optional) : The degree of depth Form Builder will apply to the image when it stores
it to the file. Datatype is VARCHAR2.

Used to zoom the image in or out.

Syntax

Image_Zoom (image, zoom_type);


Image_Zoom (image, zoom_type, zoom_factor);
Image : Indicates the id of image item or the name of the image item in char
Zoom_type : Indicates the effect that you want on the specified image. Zoom_type can
take the following values.
D2K For ms Builder

Values Description
ADJUST_TO_FIT Scales the image to fit within the display rectangle: the
entire image is visible and the image fills as much of the
image item as possible without distorting the image.
SELECTION_RECTANGLE Scales the image so the selected region fully fills the
image item
ZOOM_IN_FACTOR Enlarges the image by the zoom_factor
ZOOM_OUT_FACTOR Reduces the image by the zoom_factor
ZOOM_PERCENT Scales the image to the percentage indicated in
zoom_factor.

Ø All the images, which are stored in the database, are stored in the Oracle Format
regardless of the original type of image

Ø If you are storing the image to the file then the indicate d filetype should be consistent
with that of the image being stored in it.

Triggers associated with Image Items:

When_lmage_Activated
This trigger fires when user double -clicks on the image item

When_lmage_Pressed
This trigger fires when user clicks or double -clicks on the image item

3.6.8 Chart Item

Basically Chart items are used to view the displays generated in Oracle Graphics. The
details about this will be contained in the chapter Integration of Oracle Products (Oracle
Forms, Oracle Reports, and Oracle Graphics).

3.7 Form Templates

A template is an object that you can use to format a module with basic contents
Developer / 2000 Forms does not provide explicit templates, (like Reports and Graphics
components provide). The welcome Window of the Forms Builder lets you build a new
Form based on some already existing Form. Click on Build a New form based on a
Template radio button. The open Form dialog box lets you choose a .FMB file to use as a
template.

There is no other way to get this dialog box other than by starting Form Builder.
D2K For ms Builder

Tip:

You can also Open the template Form using the Open tool then save it under another
name using File - > Save As.

You should build a standard Form with the Objects that you want to standardize.

Some possible uses for standard objects.

Object Suggested Uses


Form Standard Form Settings in the property palette such as Menu
Module
Form Trigger When-New-Form-Instance to set up standard Window sizes
Attached Libraries Standard Libraries that multiple forms share
Popup Menus Standard popups that all application share
D2K For ms Builder

4 Master Detail Relationship

4.1 Introduction

A master- detail relationship is an association between two data blocks--a master and a
detail block. The relationship between the blocks reflects a primary key foreign key
relationship between the tables on which the blocks are based.

The master-detail relationship automatically does the following:

Ø Ensures that the detail block displays only those records that are associated the
current (master) record in the master block.
Ø Co-ordinates querying between the two blocks

4.2 Join Condition


The master block is related to the detail block through the join condition. The join
condition establishes the primary key item(s) in the master block and the foreign key
item(s) in the detail block. For example the join condition for the ORD (Master) and
ITEM (Detail) or DEPT (Master) and EMP (Detail) can be stated as follows:

:Item.ordid = :Ord.ordid or

:emp.deptno = :Deptdeptno

That is,

Detail_block. Foreign _key_Item = master - block. Primary _key Item

4.3 Block Co-ordination

To maintain the master -detail relationship at runtime, Form Builder co-ordinates master
and detail blocks to ensure that the records displayed in the detail block associated with
the current record in the master block.

Any event that makes a different record in the master block the current record is
ordination-causing event. Deleting a record or pressing [Up] or [Down] to move to
different record are both examples of co-ordination-causing events. When such a event
D2K For ms Builder

occurs, Form Builder automatically does the processing necessary to a ordinate the
master and detail blocks.

There are two phases of block co-ordination:

Clear phase During the clear phase, Form Builder navigates internally to the
detail block and flushes the irrelevant detail records.

Population phase During the population phase, Form Builder issues a SELECT
statement to repopulate the detail block with the detail records
associated with the new master record. These operations are
accomplished thr ough the execution of triggers.

4.4 Relation Object


You can define a master-detail relationship at any time during the Form development
process. You define a master-detail relationship between blocks by creating and setting
the properties of a relation object.

A relation is a logical object that specifies the relationship between one master block and
one corresponding detail block. In the Object Navigator. the rel<;ition object appears
under the block that is the master block in the relation.

When you create a relation, Form Builder generates the triggers and PL/SQL procedures
required, to enforce co-ordination between the master and detail blocks. The actual code
that Form Builder generates depends on how the properties of the relation are set.

Creating a Master-Detail Relation

Ø Create the relation on the master-detail relation page of Data Block Wizard when
you create the detail block for that relation
Ø In the Object Navigator insert a relation object under the Relations node for the
appropriate master bloc k. Both the master block and the detail block should exist

To create a relation in the New Block window:

1. Choose Tools -> Data Block Wizard to invoke the Wizard. Choose an appropriate
table for the detail block and include the columns from the table

Make sure that you include the foreign key column(s) in the block

Click on the Next button to get the Wizard's master-detail page shown in figure
below.
D2K For ms Builder

Figure 4-1: Master-Detail Page

2. Click on Create Relationship button. The following screen is displayed.

Figure 4-2: Data Blocks List

A potential master block is one that is based on a table that has a foreign I reference to
the base table of the current block. This constraint must be defined at the time of creation
of the tables. Choose the master block and the, condition gets created automatically. (The
Master Block must already be specified when you create a relationship.)

3. Click on the Next button and proceed with block formation as usual. Create the
Layout with the Layout Wizard
D2K For ms Builder

Form Builder creates the block and relation specified. In the Object Navigator, the
new relation object appears under the master block.

Figure 4-3: The Relation Object

The default relation name is in the form IT'asterblock_detailblock, for example, Ord-'tem
or Dept_Emp.

Creating a Relation in the Object Navigator

You can define a master-detail relationship between two existing blocks by creating a
relation object in the Object Navigator. Both the master block and the detail block must
already exist.

To create a relation in the Object Navigator:

1. In the Object Navigator, locate the block that you want to be the master block in
the relation. If necessary, click on the + to expand the block so that the Triggers.
Items, and Relations nodes are visible.
2. Position the cursor on the Relations node under the master block, then select
Navigator -> Create.

The relation dialog is displayed.


D2K For ms Builder

Figure 4-4: New Relation Dialog

3. The name of the master block you selected is entered for you automatically
records from the Master field. In the Detail field enter the name of the detail block
or select a block from the LOV associated with this field.
4. Set the Master Deletes, Co-ordination, Join Condition, and Prevent Masterless
Operation properties as desired then choose OK to accept the relation definition.

Specifying the Join Condition for a M aster-Detail Relation

The maximum length for Join Condition is 255 characters you can specify a join
condition with the following entries:

Ø An item name that exists in both the master block and the detail block (do not
preface the item names with colons).

Ø an equating condition of two item names where one item exists in the mal master
block and the other exists in the detail block

Ø You can also have a compound join condition as


block1.item1 = block2.item1 and block1.item2 = block2.item2

The primary-foreign key relationship between the base tables in the database can. Can be
a purely logical one. It is not required that the relevant tables and columns have explicit
primary key or foreign key column constraints.
D2K For ms Builder

The properties that affect the functionality of a relation are

Ø Delete Record Behavior (Master Deletes)


Ø Co-ordination
Ø Prevent Masterless Operation

Delete Record Behaviour


This property allows you to specify how the deletion of a record in the master block
should affect records in the detail block. It can be set to Non-Isolated, Isolated, or
Cascading.

Non-Isolated
The default setting prevents the deletion of a master record if associated detail records
exist in the database.

Isolated
Allows the master record to be deleted and does not affect the associated detail records
exist in the database.

Cascading
Allows the master record to be deleted and automatically deletes any associated detail
records from the base table at commit time. When relations are nested to several levels,
only records in the immediate detail block are deleted. That is deletions do not
automatically cascade to multiple levels of a relation chain.

block1.item1 = block2.item1 and block1.item2 = block2.item2

If your database is using the cascading deletes feature on the Server side do not use the
Cascading deletes option in Form Builder.

Co-ordination Properties
The Co-ordination properties Deferred and Auto-Query determine when the population
phase of block co-ordination should occur. Co-ordination of the detail block with its
master can be

Ø Immediate
Ø Deferred with Auto-query
Ø Deferred with No Auto-query

Co-ordination Description
Immediate Here the deferred and auto-query are both not checked
i.e. are set to false. It is the default setting When co-
ordination-causing event occurs the detail records are
fetched immediately.
Deferred with Auto-query Deferred and auto-query are both checked, set to True.
D2K For ms Builder

When a co-ordination-causing event occurs. Form


Builder defers or delays fetching the associated detail
records until the operator navigate to the detail block.
Deferred with No Auto-query Deferred IS set to True and auto-query IS set False.
When a coordination-causing event occur Keep in I
Form Builder does not automatically fetch the detail
records. To fetch the detail records, the operator must
navigate to the detail block and explicitly execute a
query.

Prevent Masterless Operation

Specifies whether operators should be allowed to query or insert records in the detail
block. When set to True, Form Builder does not allow records to be inserted in the detail
block when there is no master record in the master block, and does not allow querying in
the detail block when there is no master record that was retrieved from the database.

Deleting a Master-Detail Relation

You can delete a master-detail relation by selecting it in the Object Navigator a choosing
Navigator->Delete. The following table shows what happens when you de_ a relation or
an object that is part of a relation:

If you delete This is the Result


A Relation Form Builder deletes all of the master -detail triggers that are
attached to the relation's master block and clears the Copy
Value from Item property of foreign key item(s) in the detail
block.
The master or detail block Form Builder deletes the relation and all of the master detail
in a relation triggers. Form Builder does not delete the mas!! detail
procedures.
If you delete This is the Result
A detail block in a master- Form Builder deletes the relation and removes the relevant
with-independent-details detail section from the On-Clear-Details trigger. Any
relation comments code that are added to this section are also
removed.
The Foreign Key column The master-detail block co-ordination is disrupted. Although
the foreign key item of the detail block can be hidde n by
making it a null canvas item. It cannot be deleted entirely.
Any master-detail trigger It disturbs master-detail block co-ordination.
or procedure

Complex relations and cascading Deletes

Keep in mind that when you set the Delete Record Behavior pr operty of a relation to
Cascading, the deletes are enforced only for the immediate detail block in the relation.
D2K For ms Builder

For example, consider the complex master -detail relation involving relations' between
blocks A and B (A_B), and. Band C (B_C) where-B is both the detail block in the A_B
relation and the master block in the B_C relation.

When the Delete Record Behavior property is Cascading for the relation A_B, the detail
records in Block B are automatically deleted if the master record in Block A is deleted.
Detail records in Block C are not automatically deleted when a master record In Block A
is deleted. But if the Delete Record Behavior property of relation B_C is Cascading, then
detail records in Block C are deleted when Block A is deleted. This is because deletion of
records in Block A cause records in block B to be deleted. This in turn causes deletion of
detail records in Block C as the corresponding master records from Block B are deleted.

Master-with-dependent-details

A master-with-dependent-details relation includes a master b10ck and n levels of detail


blocks, such that the first detail block is itself a master for its own detail block.

To create a master -with-dependent-details relation, define the individual relations A_B


and B_C separately (in any order).

When you create this type of relation, consider the effect of the Delete Record Behavior
and Coordination properties on the detail blocks. For example, if one relation in a chain
of related blocks is set to deferred coordination, all subsequent blocks will also be
deferred. Thus, when relation A_B is deferred and relation B_C is immediate, Form
Builder does not coordinate Block C with Block B until Block B is coordinated with
Block A.

Master-with-independent-details

A master -with-independent-details relation involves two or more detail blocks, both


sharing the same master block. This structure is useful when you want to display more
than one set of detail records for a single master record. A coordination-causing event in
the master block results in both detail blocks being populated with the appropriate detail
records.

To create this type of relation, define the individual relations A_B and A_C separately (in
any order).

Detail-with-two-masters

A detail-with-two-masters relation involves a single detail block that has two master
blocks. Form Builder displays the appropriate detail records for whichever master block
is the current block in the form. For example, in the sample application referred to earlier,
the ORD block could be a detail bloc k having two master blocks CUSTOMER and EMP.
End users could then see all of the orders for a particular_ customer, or for a particular
sales representative (employee).
D2K For ms Builder

Usually, when you create a detail-with-two-masters relation, you will be joining on


(different foreign-key items in the detail block. In such cases, the Copy Value from Item
property is set for each foreign-key item in the detail block to point to the primary-key
item in the appropriate master block. To create this type of relation, you need only define
the two relations; Form Builder will automatically support coordination.

In other cases, however, you might want to create master-with-two-details with each
relation joining on the same foreign-key item in the detail block. However, because the
Copy Value from Item property can only point to one master block item, you will need to
write additional code to coordinate querying and updating for the second relation if you
are joining on the same item in the detail block.

Depending on the desired functionality, this might include writing a Pre-Query trigger for
the detail block to ensure that the correct primary-key item value is copied to the foreign-
key item in the detail block. For example,

COPY(NAME_I N( :system. master _blockl/'. primary_key jtem'),


'detail_block. item'};

You might also want to create a When-New-Block-Instance trigger that checks the
coordination status of the detail block whenever the end user navigates to a different
master block, and, if necessary, populates the detail block.
D2K For ms Builder

5 Events and Triggers

5.1 Events and Triggers

Introduction

In a Developer/2000 application the question is where to put the code. Since you are not
developing the application from scratch, you have to put the additions into the already
existing Developer/2000 logic. Hence you need to understand what processes are and
where the triggers fire within those processes. 0/2000 applications are Event-driven i.e.
when you run an application you interact with runtime system to cause events, which in
turn start various form processes. The form processes contain the preprogrammed
behaviour for forms, reports and graphs. As various internal events occur during this
processing, the runtime system handles them by running the code you have written in
PL/SQL.

5.1.1 Concepts

What are Triggers?

Triggers are blocks of PL/SOL code you can attach to another object. : a form ,a data
block ,or a data block item. But unlike procedures or functions these blocks of code fire
or execute in response to Events. So, what are Events? We ll, an event can be anything
like 'Pressing any Key' or 'Clicking the mouse button' or 'Inserting or saving a record'.
Whereas, your trigger is the code, which will be executed in response to the occurring of
the event. Thus, we can write triggers to add functionality to a default application.

The user interacts with the application by moving the focus from object to object. This
movement is 'navigation' .By navigating from item to item, record to record, block to
Process block or form to form the user controls the tasks that comprise the application
Navigation Events (going to a different item. going to a different record, going to a
different block, going to a different form) constitute the basic events of your form
application.

Every trigger has a name and encapsulates PL/SQL code so that it can be associated with
an event and executed and maintained as a distinct object. Names of the trigger
correspond to runtime events. In other words Trigger names correspond to Runtirne
Events. For example Key-Next-Item trigger corresponds to pressing of the [next
item_key]. Oracle executes the code present in the trigger when [next item key] is
pressed.
D2K For ms Builder

Ø Hierarchy of navigational objects:

In Developer 2000 Forms, the navigational objects are arranged in a hierarchy of


navigational units. The form contains a series of blocks, each of which contains a
set of records and a sequence of items. Part of the navigational behaviour of forms
is the autom_tic navigation that occurs because of user actions. For e.g. if the
focus is on an item in a block and you click on an item in another block, this
action navigates from item to item. Because the items are in different blocks, you
also navigate from block to block at the same time. If the blocks each have
different records, you navigate from record to record (Each of these navigational
events has a different consequence, such as certain triggers firing (WhenValidate-
Item, When-Validate-Block, When-Validate-Record, respectively, in this case).

5.1.2 Processes and Sub-processes

Developer /2000 applications are Event-driven. When you run an application you interact
with runtime systems to cause events, which in turn start various form processes. The
form processes contain pre-programmed default behaviour for forms, reports, and
graphics. As various internal Events occur during this processing the runtime systems
handles them by running the code you write in PL/SQL : it fires triggers.

Oracle Forms is event driven. When we say this, we mean that whenever Oracle Forms
detects an event, it initiates a process to accomplish the event. Forms predefine this
process. A process is a series of individual, related events that occurs during a specific
Oracle Forms Runform operation. The process involves validation, navigation and
database transactio ns. There are over hundred events. Each event can have a different
series of individual events that occur in order to accomplish the parent event.

5.1.3 Augmenting Default Processing

For every event, Oracle Forms provides predefined triggers that can be used to augment
or enhance default processing. To enhance default processing, you associate a trigger
with an event. The trigger modifies the manner in which Oracle Forms processes the
event. When Oracle Forms detects an event and the trigger is present, Oracle Forms
executes the trigger code. Some events can cause more than one trigger to fire. Anyone of
the triggers can be used to modify default processing

A trigger can be defined to do any of the following:

Ø Override the default process


Ø Execute before the default process
Ø Execute after the default process

This can be done by setting the trigger property Execution Hierarchy in the trigger
property palette.
D2K For ms Builder

5.1.4 Trigger Definition Level and Scope

When you create a trigger, you attach it to a specific object, either an item, a block, or the
form itself. The trigger's scope is the set of objects that fire the trigger; it consists of the
object that owns that trigger and any object belonging to that object. For e.g., if you
attach a trigger to a block, events in all the items in that block fire that trigger. Triggers
scope is defined at the trigger definition level. Thus, a block level trigger fires within that
block, but not in another block.

If there is more than one trigger with the same name in a particular scope by default
developer/2000 fires the one attached to the object lowest in the hierarchy. For e.g., if
you have a When-New-Item-Instance trigger on both an item and that item's block
Developer/2000 fires the trigger on the item and ignores the one on the block .You carn
change this behaviour for a particular trigger by changing the Execution Hierarchy
property of the trigger in the triggers property palette. The default is 'Overide' but you can
also choose Before or After.

Some triggers make sense only when defined at a specific level. When-Validate-Record.
for e.g. does not apply to individual items, so you can define it only at block and form
levels. Developer/2000 V 2.0 adds the SmartTriggers feature which identifies the most
likely triggers to define for a particular object.

To use this feature, right click the object for which you want to define a trigger in the
Object Navigator or Layout Editor.

5.1.5 Creating a Trigger

Triggers are named objects, the properties of a trigger determine its scope and
functiona lity. Consider the following before creating the trigger.

Ø the name of the trigger, that is, the event that causes it to fire
Ø the object to which the trigger is attached i.e. the scope of the trigger
Ø the PL/SQL code that executes when the trigger fires

Steps to create a trigger


1. Select the Triggers node under form, Block or Item seen in the object navigator and
choose Navigator -> Create.
D2K For ms Builder

Figure 5-1: Trigger Names LOV

2. A list of trigger names is displayed. Highlight the trigger you require and click on
OK button.

3. The PL/SQL Editor is displayed. Here you define the scope of the trigger. You can
define the triggers at three levels

Ø Form level
Ø Block level
Ø Item level

Figure 5-2: PL/SQL Editor

4. Set the Scope of the trigger by attaching the trigger to an object in the form. In the
object field you can select the block name, if the trigger which you want to define is
D2K For ms Builder

a block level trigger. Within a block if you ha ve to define the trigger on an item then
you can specify that too.
5. Enter the PUSOL code in the trigger. Choose compile to have Oracle Forms
compile the trigger text. Oracle Forms also compiles all the triggers in a form when
you generate the form.

5.1.6 User-Names Triggers

Most triggers you use are built-in triggers, triggers that Developer /2000 supplies these
triggers come in several categories. Each trigger has a specific name - When-Button-
Pressed, Post-Query, On-Delete that you choose from a list of trigger names. You can
also add your own user-defined triggers & fire them explicitly.

A user named trigger is one that has a unique user supplied name. A user named trigger is
executed by calling it in built-in trigger or user-named routines. The procedure
Execute_Trigger is used to call the trigger.

5.1.7 Trigger Categories

Different triggers have been explored in brief below:


Trigger Description
1 Block-processing Activates in response to events related to record
management in a block.
2 Interface event Activates in response to events that occur in Form
interface
3 Master detail Oracle Forms generates master-detail triggers
automatically when you define a master_detail relation
between blocks.
4 Message handling Activates in response to the occurrence of Errors or
default Forms messages.
5 Navigational Activates in response to the occurrence of navigation
event. The navigational event can be any event like
navigating from one item to another.
6 Querytime Activates just before and just after a query is executed in
a block.
7 Transactional Caused by response of the database to the application
request to get information or desire to act on data.
8 Validation Occurs when Forms validates the data or a record.
9 Whenevent You can add additional tasks or operations to Oracle
Forms default processing in these triggers.
10 On-event You can replace Oracle Forms default processing.
These are the subevents that fire before the execution of
11 Pre-event
On-event or When-event triggers. E.g. Pre-insert trigger
occurs before the execution of On-insert trigger.
D2K For ms Builder

12 Post-event These are the subevents which fire after the execution of
On-Eevent or when event triggers. E.g. Post-insert event
occurs after the execution of On-insert trigger
13 Key Triggers Activated by pressing specific function keys

Before we explore these triggers in detail, let us first understand how procedure occurs in
Forms.

5.2 Processes in Forms

5.2.1 Navigational Processing in Oracle Forms

Entering or leaving any object in an application (be it a form, block, record or item)
causes navigation. The Pre-Navigational triggers (Pre-Form, Pre-block, Pre-Record, Pre-
text-Item) occur for that object just before entering into that object. Leaving an object
causes the Post-Navigational triggers to fire (post-Form, Post-Block, PostRecord, Post-
Text-Item).

Navigational triggers such as the above do not support Restricted Package Procedures
(RPPs are built-in procedures in Oracle Forms that cause navigation to take place). Since
the above triggers fire in response to such restricted package procedures, they cannot be
used in the above triggers where the form is still in a state of navigation. However, it is
possible to use restricted package procedures navigational triggers such as When-New-
object-Instance because these triggers fire only after navigation to the object (Form,
Block, Record or Item) is complete.

5.2.2 Query Processing in Oracle Forms

A query is a request to the database. An Oracle Form application has an in-built query
process that gives you a lot of flexibility without writing a single line of code.

Query Processing involves three main steps:

Ø The concept of creating an example record in a block (Le. enter a query) that lets
you enter conditions to attach to the default query
Ø Next, you execute the query that you entered
Ø Executing a query will cause the rows to be fetched into the block

Entering a Query

When you enter a query In an Oracle Forms applIcation by pressing the [Enter Query]
key or calling the ENTER_QUERY built-in procedure, you are building the SELECT
statement.
D2K For ms Builder

SELECT select-list
FROM table
WHERE query-condition
ORDER BY order-by-list

The select-list is the set of column names that correspond to your record items. The table
is the base table that corresponds to the block in the form. The order-by-list is a list of
columns in the select statement that specifies the order for the queried records.

The query-condition is the set of SOL expressions that specifies which records return.
This set of expressions has three parts.

Default Conditions

It is the set of conditions you specify as the default where clause in the block property
palette at design time. It can also be changed at runtime through a trigger.

Ø Column condition
Conditions you enter by filling out columns in the example record in the Enter-
Query mode.

Ø Special condition
Conditions you enter through the Where dialog box in the Enter-Query mode
When you are entering a query, oracle Forms does not validate items or records
and does not permit navigation out of the current block in which you are to enter
the query.

The Query Allowed block property lets you disable a query for a block. You should
specify a block to be a control block by leaving the Base Table property of the block
blank. In which case query for the control block will not be performed.

Executing a Query

Once you have entered your query conditions, you then execute the query by pressing the
[Execute Query] key or calling the built-in procedure EXECUTE_QUERY. However you
can execute a query without having entered a query first. In this case all the rows will be
retrieved using only the default where clause of the block property.

When you execute a query, Oracle Forms first checks whether the block allows queries.
If so, it navigates to the block, validating any records that have not being validated. If
there are Changed records in the block, it prompts the user to commit, post or clear the
changes before executing the query.

Oracle Forms then fires the Pre-Query trigger for the block. The Pre-query trigger is the
last event in which you can still modify the default where condition so as to alter the
D2K For ms Builder

query criteria after which the Oracle Forms will actually start building the select
statement internally.

SELECT basetable.column1, basetable.column2 INTO


Block.item1, block.item2...
From basetable
WHERE <Default Where condition>
< Column Condition>
< Special Condition>
ORDER BY <Order_By>

During the selection phase Oracle Forms fires the Pre-Select trigger. (Fires during
Execute Query and Count Query processing after Form Builder constructs the SELECT
statement to be issued, but before the statement is actually issued. Note that the SELECT
statement can be examined in a Pre-Select trigger by reading the value of the system
variable SYSTEM. LAST_QUERY.)

If there is an On-Select trigger it executes the SELECT statement. The Post-Select and
When-Clear-Block triggers are fired next. The example record is flushed from the block.
Forms then fetches the rows.

Fetching Records

After completing the process of executing the SQL query, Oracle Forms organizes the
fetching of records.

5.2.3 Transaction Processing

A forms transaction is a sequence of events, processes and triggers that ultimately results
in either saving data to the database or rolling back changes.

The process of Posting to the database

Posting to the database means writing any pending changes in a form to the database
through a series of INSERT, UPDATE and delete statements. Oracle Forms generates
these statements as a part of default processing. Post does not commit changes to the
database. A post is always followed by a commit or rollback as a part of default
processing.

During the process of Posting, Oracle Forms navigates to the form and validates it. IF
there are no changes that require posting, the process stops right here. If there are changes
that require posting, then Oracle Forms issues a savepoint.

A savepoint is a feature of Oracle that separates database transaction into segments. So


that in case you want to rollback a part of your transaction, you can do so without rolling
D2K For ms Builder

back the entire transaction. This permits Oracle Forms to post multiple times without
rolling back all the posts except the one that failed.

After issuing a savepoint, Oracle Forms fires the Pre-Commit trigger, (this is the first
trigger to fire as a part of the default processing of Post and Commit). For each block in
the Form, Oracle Forms validates the block, then determines whether the block has any
changes that affect the database. If the block is a control block, then it has no such
changes. The database operation for posting is done, In the following sequence
irrespective of the sequence in which the user perform the inserts, updates and deletes.

Deletes take place first


Next Updates and
Lastly Inserts

Oracle Forms builds statements internally for each row of the block that is deleted,
updated or inserted.

During the Posting process it fires Pre-Event, On-Event and Post-Event triggers for each
of the events of Insertion, Updation and Deletion as a part of the default processing.

The On-Insert trigger calls a package procedure Insert_Record that actually builds the
Insert statement internally and inserts a row into the table.

The On-Update trigger calls a package procedure Update_Record, which actually builds
the Update statement internally and updates a row in the table.

The On-Delete trigger calls a package procedure Delete_Record, which actually builds
the Delete statement internally and deletes a row in the table.

After processing all the blocks in the form, it fires the Post-Forms-Commit trigger
marking the end of the Posting process.

At this point of time all changes are written to the tables, but not committed to the
database. Hence a rollback is possible.

Next, the database commit takes place when Oracle Forms fires the On-Commit which by
default calls the Commit_Form package procedure.

After the database commit, the Post-Database-Trigger fires and from here on it is not
possible to rollback the changes committed.

5.2.4 The Process of Validation in Forms

Validation is the process of making sure that an object satisfies all the constraints defined
on it. Oracle Forms automatically validates Blocks, Records and Items. You can provide
additional functionality by adding constraints as a part of the validation process (through
D2K For ms Builder

the validation triggers).

Validation process in a form gets initiated automatically in the following situations

Ø When the user tries to navigate out of an item whose item state is new or changed.
(E.g. pressing the enter key or tab navigating or through a call to the ENTER
built-in-procedure).
Ø As part of the default processing of Post and Commit

Item States and Validation

An item can have three states

1. New
2. Changed
3. Valid

An item is created in any of the three ways:

By Creating a new record:


Creating a record creates the items in it as New. Oracle Forms can fill values in it with a
default value or copy it from another item.

Duplicating a record:
Duplicating a record copies the values from the previous record into the new record. The
state of the items in the new record can be in any of the following states, New, Changed
or Valid.

Fetching a record from the database:


Fetching the record immediately marks the item in the record as Valid. (If the item status
is valid, then validation related triggers would not fire).

When you modify an item in any way, Oracle Forms marks the item as Changed. All
validation related triggers fire for an item whose status is New or Changed. If validation
fails for some reason, then the cursor remains on the item itself forcing the entry of a
valid value.

After successful validation of an item depending on its status, Oracle Forms marks the
item as Valid, so no future validation is needed if the user navigates out of the item
without modifying it once again.

Record State

A record has three validation states,

Ø New
D2K For ms Builder

When you create a new record, the object is new.

Ø Changed
When you modify any item of a record (so as to enter a value or edit the existing one) the
record status becomes changed.

Ø Valid
A record is said to be valid if ->

Ø Oracle Forms validates all the Changed or New items in the record and validates the
record.
Ø Soon after it fetches the record from the database or commits the record to the
database or commits the record to the database
Ø Record validation takes place only for records with Changed status

Form and Block Validation

Validating a Block means validating all the records in that block

Validating a Form means validating all the Blocks in that Form.

Locking in Oracle Forms

Locking makes the transaction serializable. Oracle Forms uses row exclusive locks which
prevent other transactions from updating or deleting the row.

By default, Oracle Forms acquires row locks under any of the following circumstances.

When the operator changes the value of a base table in a database row.

When the operator requests an explicit lock through the record -> lock menu item.

When a trigger makes a change to the database through an update or delete statement.

When a trigger calls, the following built-ins Enter-Query (For_Update), Execute_Query


(For_Update) or Lock_Record.

When a trigger calls an explicit SQL Lock Table….. statement

Locks automatically get released as soon as the transaction commits or rollbacks.

5.2.5 Block Processing Triggers

When-Clear-Block:

Fires whenever Form Builder flushes the current block; that is, removes all records from
D2K For ms Builder

the block.

This trigger fires just before Oracle Forms clears data from the current block. May be
used to perform automatic commit before flushing rows from the block. Clear Block
(commit_ mode). It fires during query processing, but does not fire when Forms executes
the CLEAR_FORM built-in.

Fires in: Clear_Block, Count_Query, Enter_Query

When-Create-Record:

Fires when Oracle Forms creates a new record. When user presses the [Down] key after
navigating to the last record in the block or the [Insert] key or selecting the menu item
Record -> Insert.

May be used to assign default values to the form items, without marking the record as
changed.

Example

To set the hiredate column in the Emp Block to the current date, each time a new record
is created.
Trigger: When-Create-Record of Emp Block

Begin
Select sysdate into :Emp.hiredate
From Dual;
End;

When-Database-Record
Fires when Oracle Forms first marks a record as an insert or update. This occurs when the
commit status changes from new to insert or from query to changed.

When-Remove-Record:
Fires before Forms clears or deletes a record (Clear_Record, Delete_Record).

5.2.6 Interface Event Triggers

When-Button-Pressed:
Fires when the user selects a push-button, either by a mouse click or keyboard
interaction. May be used to initiate an action like commit a form, exit a for, clear a block,
perform a query etc.

Example:

To commit a form, if there are any changes made to it.


D2K For ms Builder

Trigger: When-Button-Pressed of a Button – Save

Begin /* If changes have been made to the form, then commit the form */
If :System.Form_Status = 'CHANGED' then
Commit_Form;
/*If the changes have been saved successfully,
then the form status changes to 'QUERY'*/
If : System. Form_Status <>'QUERY' then
Message('Commit Failed');
Raise Form_Trigger_Failure;
End if;
End if;

End;

When-Mouse-Click:
Fires when user clicks depending on the object to which it is attached.

Events: Mouse Down:


Mouse Up
Mouse Click

When-Mouse-Double-Click:
Fires when user double clicks depending on the object to which it is attached.

Events: Mouse Down


Mouse Up
Mouse Click
Mouse Down
Mouse Up
Mouse DoubleClick

When-Mouse-Enter:
Fires when the mouse enter the item, block or form to which it is attached. May be used
to enable or disable an item on its entry or display the balloon help.

When-Mouse-Leave:
Fires when the mouse leaves the item

When-Radio-Changed:
Fires when the user selects a different button in the radio group.

When-Time-Expired: (Discussed Later)

When-Window-Activated:
Fires when a window is made the active window. Also fires at form start-up. All window
D2K For ms Builder

related triggers are form level triggers.

When-Window-Deactivated:
Fires when a user deactivates a window by setting the input focus to another window.

When-Window-Closed:
Fires when the user closes a window using the window specific close command (using
the control menu)

When-Window-Resized:
Fires when window is resized by a call to the RESIZE_WINDOW () built-in. It also fires
at form start-up.

5.2.7 Master-Detail Triggers

On-Check-Delete-Master:
This trigger automatically created when you define a master-detail relation and set the
Relation Object's property for Master-Deletes to Non-Isolated. It fires when the user tries
to delete a row in the Master block in a Master-Detail Form. The trigger queries the
database to see if detail record exist for the master record. If details exist, the trigger
displays the message "Cannot delete master record when matching detail records exist”

On-Clear-Details:
This trigger is automatically created when you define a Master-Detail relation. It fires
during the clear phase of co-ordination, and clears all of the detail records in the detail
block. Co-ordination causing events can Delete_Record, Clear_Record. This trigger calls
the Clear_All_Master_Details procedure.

On-Populate-Details:
Oracle Forms creates the On-Populate-Details trigger for every master-detail relation. It
fires during the population phase of block co-ordination. The trigger first checks the
status of the master record and the value of its primary key field, then navigates to the
detail block to issue the appropriate query. The trigger calls the Query_Master_Details
procedure.

5.2.8 Navigational Triggers

These triggers fire in response to navigation in a form or on account of certain


transactions that take place between oracle forms and the oracle database.

Pre-Form:
It fires at form startup. It is the first event to take place. It may be used to perform an
action just before Oracle Forms navigates to the Form from. “Outside” the form. It may
be used to initialize global variables and check authorization
D2K For ms Builder

Pre-Block:
It fires just before entering the block process. It may be used to perform an action before
Oracle Forms navigates to the block level from the form level. You can provide the entry
into the block on a particular condition by filling the trigger.

Pre-Record:
It fires just before entering the record. It may be used to perform an action before Oracle
Forms navigates to the record level. You can setup global variables as well as visual
attributes.

Pre-Text-Item:
It fires just before entering the item. It may be used to perform an action before Oracle
Forms navigates to a text item. You can set up global variables.

Post-Text-Item:
It fires after leaving the item. You can manipulate an item when Oracle Forms leaves a
text item. You can set up global variables as well as clear Global variables.

Post-Record:
It fires after leaving the record. You can manipulate a record when Oracle leaves a
record, you can clear global variables and reset visual attributes.

Post-Block:
It fires after leaving the block. You can set or clear global variables.

Post-Form:
It fires after leaving the form. This trigger may be used to erase global va riables, remove
recordgroups etc.

When-New-Form-Instance:
It fires at form start-up after navigation to the form is complete, Restricted package
procedures such as Go_ltem() etc. can be used in this trigger. It can be used to initialise
the form, perform query and navigation at start-up.

When-New-Block-Instance:
It fires after navigation to the block is complete. Fires each time a block is visited. It can
be used to initialise the block and perform query. It supports restricted package
procedures.

When-New-Record-Instance:
It fires after navigation to the record is complete. Fires each time a record is visited. It
can be used to initialise the record, set visual attributes. It supports restricted package
procedures.
D2K For ms Builder

When-New-Item-Instance:
It fires after navigation to the item is complete. Fires each time an item is visited. It can
be used to initialise the item, invoke LOV or Editor. It supports restricted package
procedures.

When-New-Instance triggers fire just after Forms has put the cursor in the Target location
and starts waiting for the user actions. Unlike the Pre- and Post -navigational triggers, the
When-New-Instance triggers do not fire in response navigational events that occur during
default form processing.

Post triggers will not fire, if the validation process for that object fails. Pre triggers do not
fire in Enter Query Mode.

5.2.9 Transactional Triggers

Transactional triggers fire in response to a wide variety of events that occur as a form
interacts with the data source.

On-Check-Unique:
This trigger fires during a commit operation when Oracle Forms normally checks record
that the Primary key values are unique in a base table, It fires once for each et visual
attributes, record updated or inserted. If a duplicate is found, Oracle forms displays the
following message,
FRM -40600 Record has already been inserted

On-Column-Security:
This trigger fires when the block property ‘Column Security’ is set to True.

On-Count:
Fires when Oracle Forms performs the Count Query operation, to determine the number
of rows that the query criteria will retrieve. It prompts the following message,
FRM xxxxxx : Query retrieved x rows

On-Close
This trigger fires when the query is closed either by an Abort_Query process or when all
the records that satisfy the query criteria have been retirieved.

Pre-Commit:
This trigger fires once during the post and commit phase as apart of the default
processing of posting and committing. When the user initiates a commit, it is the first
trigger that marks the start of the posting phase.

Pre-Delete:
This trigger fires during the post and commit process. It typically fires just before the On-
Delete trigger. It fires once for every row deleted. It may be used to prevent deletion of
D2K For ms Builder

the record if certain conditions exist.

On-Delete:
This trigger fires during the post and commit process. Typically, it fires after the Pre-
Delete trigger and before Post-Delete-Trigger. It fires for every row deleted.

Post-Delete:
This trigger fires during the post and commit process. Typically, it fires soon after the
On-Delete trigger. It fires for each row deleted.

Example
Ensure that the employee details are recorded in an employee retirement table upto the
employee’s retirement.

1. Consider you have a table EMP_RET

Empno not null number (4)


Ename char (10)
Job char (9)
Mgr number (4)
Hiredate date
Deptno not null number (2)
Retdate date

2. Create a block with base table Emp


3. Write a pre-delete trigger at block level as follows

Insert into Emp_Ret (:Emp.Empno,:Emp.Ename,:Emp.Job,:Emp.Mgr,


:Emp.Hiredate,:Emp.Deptno,sysdate);

Pre-Update:
This trigger fires during the post and commit process. It fires just before the Update
trigger. It fires once for each row updated.

On-Update:
This trigger fires during the post and commit process. It fires once for every row updated.

Post-Update:
This trigger fires during the post and commit process. It fire typically soon after the On-
Update trigger. It fires once for each row updated.

Pre-Insert:
This trigger fires during the post and commit process. It fires just before the On-Insert
trigger. It fires for each row inserted.
D2K For ms Builder

On-Insert:
Fires during the post and commit process. It fires once for each row inserted in the
default sequence. May be used to populate derived columns, to assign values to items not
displayed in the form.

Default Processing : Insert_Record.

Post-Insert:
This trigger fires during the post and commit process. It fires typically soon after the On-
Insert trigger. It fires once for each row inserted. May be used to update an audit trail.

Post-Forms-Commit;
This trigger fires after all changed rows are written (posted) to the database. It fires after
the form levels post is complete but before the database commit. A rollback is possible
from here. It fires before the On-Commit trigger.

On-Commit:
This trigger fires when Oracle Forms would normally issue a database commit statement
to finalize the transaction. It will fire once after all the Inserted, Updated and Deleted
rows are posted in the default sequence.

Default Processing : Commit_Form

Post-Database-Commit:
This trigger fires after the On-Commit trigger, after the transaction is finalized and a
database commit is done. No rollback is possible from here. May be used to refresh
record groups, re-initialize global variables.

On-Lock:
This trigger fires as soon as the user acquired a lock on the row when he attempts to
update or delete the row.

On-Logon:
This trigger fires once per login when Oracle forms normally initiates the logon
sequence.

Default Processing : LOGON

On-Logout:
This trigger fires once per log out when Oracle forms normally initiates the log out
sequence.

Default Processing : LOGOUT


D2K For ms Builder

On-Sequence-Number:
This trigger fires when Oracle Forms normally perform the default action of generating
sequence numbers for the default item values. (When Oracle Form interacts with the
database to get the next value from a sequence object).

Default Processing : Generate_Sequence_Number

5.2.10 Validation Triggers

When-Validate-Record:
This trigger fires when the user navigates out of the record or as a part of the default
sequence of posting. It will fire only for records whose status is Changed.

Example
To check if the date of retirement of an employee is always greater than his date of
joining.

Trigger: When-Validate -Record

Begin
If :Emp.hiredate > :Emp.RetDate Then
Message('Invalid Dates ');
Raise Form_Trigger_Failure;
End if;
End;

When-Validate-Item:
This trigger fires when the user attempts to navigate out of the item or as a part of the
default sequence of posting. It fires for items with status as New or Changed.

Example
To populate control items (non-base table) during data entry. In the Order Entry form,
populate the values of the Customer name and Customer Address depending on the value
of the Custid field entered by the user. (Name and Address are control items)

Trigger: When-Validate -Item of Column Ord.Custid

Begin
Select name, address Into :ord.name, From customer
Where custid = :ord.custid;
End;
D2K For ms Builder

5.2.11 Query Time Triggers

Pre-Query:
This trigger fires durin g execute query or count query processing, just before Oracle
Forms constructs and issues the Select statement to identify rows that match the query
criteria. It may be used to alter the example record that determines which row will be
identified by the query. If the trigger fails, the query is cancelled.

Example

Allow the user to query the Emp table based on the Department number selected at
runtime. Also allow the User to sort the output on any one of the following columns:
Empno, Salary or Hiredate.

Ø Create a block Emp


Ø Create a control block ‘Ctl’
Ø In Ctl create a radiogroup ‘Sort’ having 3 radio items

Name Label Value


Eno Empno E
Salry Salary S
Hdate Hiredate H

Ø Write the following in the Pre-Query trigger

Declare
ord- by char (1) ;
Begin
ord_by : = : ctl. sort;
If ord_by = ' E ' then
set_block_property('Emp',order_by, 'Empno');
Elsif ord_by = 'S' then
set_block_propertY('Emp',order_by, 'Sal');
Elsif ord_by = 'H' then
set_block_property( 'Emp' ,order_by, 'Hiredate' ).;
End If;

End;

Post-Query:
When a query is open in a block, this trigger fires each time Oracle Forms fetches a row
into the block. It may be used to populate control items (non-based table items), calculate
statistics about records retrieved and calculate running totals.
D2K For ms Builder

Example
To populate the department name into a control item in the Emp block for each
employee.

(Dept_Name is a non-base table item in the Emp block)


Trigger: Post-Query

Begin
Select dname into :emp.dept_Name From dept
Where deptno = :emp.deptno;
END;

Message-Handling Triggers

On-Error Trigger
It fires in response to any error. It can be used to trap errors. You can change the default
error message given by Forms and replace it with your own message.

On-Message Trigger:
It fires in response to a default message by Oracle Forms. You can use it to change the
default message to the custom message.

TRIGGERS that cannot use restricted built-in subprograms


On-Check-Delete-Master Post-Block Pre-Insert
On-Cheek-Unique-Trigger Post-Change Pre-Logon
On-Close Post-Database-Commit Pre-Logout
On-Column-security Post_Delete Pre-Query
On-Commit Post-Form Pre-Record
On-Count Post-Form-Commit Pre-Select
On-Delete Post-Insert Pre-Text-Item
On-Error Post-Logon Pre-Update
On-Fetch Post-Logout When-Clear-Block
On-Insert Post-Query When-Create-Record
On-Lock Post-Record When-Custom-Item-Event
On-Logon Post-Select When-Database-Record
On-Logout Post-Text-Item When-Image-Activated
On-Message Post-Update When-Remove-Record
On-Savepoint Pre-Block When-Validate-Item
On-Select Pre-Commit When-Validate-Record
On-Sequence-Number Pre-Delete
On-Update Pre-Form

Triggers that can use Restricted built-ins


D2K For ms Builder

Key - <Triggers> When-List-Changed When-New-Item-Instance


Key -F<n> When-Mouse-Click When-New-Record-Instance
Key-others When-Mouse-DoubleClick When-Radio-Changed
On-clear-details When-Mouse-Down When-Timer-Expired
On-Populate-Details When-Mouse-Enter When-window-Closed
On-Rollback When-Mouse-Leave When-Window-Deactivated
When-Button-Pressed When-Mouse-Move When-Window-Resized
When-Checkbox- Changed When-Mouse-Up
On-Rollback When-New-Block-
When-Form-Navigate Instance
When-Image-Pressed When-New-Forrn-Instance
When-List-Activated
When-Tab-Page-Changed

Restric ted-Built-Ins:

Block Menu Delete_Record Help Post


Call-Input Down Insert_Record Previous_BlocK
Clear-Block Do_Key Last_Record Previous_Form
Ciear-EOL Duplicate_Item List_Values Previous_Item
Clear-Form Duplicate_Record Main_Menu Previous_Menu
Clear-Item Edit_Textitem Menu_Next_Field Previous_Menu_Item
Clear_Message Enter New_Form Previous Record
Clear Record Enter_Query Next_Block Scroll_Down
Close_Form Execute_Query Next_Form Scroll_Up
Commit_Form Execute_Trigger Next_Item Select_All
Convert_Other_Value Exit_Form Next_Key Select_Records
Copy_Region First_Record Next_Menu_Item Show_Lov
Count_Query Go_Block Next_Record Terminate
Create_Queired_Record Go_Form Next_Set Up
Create Record Go_Item Open_Form Update_Record
Cut_Region Go_Record Paste_Region
D2K For ms Builder

6 Property Classes and Visual Attributes

6.1 Introduction to Property Class

A property class is a named object belonging to a module that contains a set of properties
and their settings. Once you create a property class you can base other objects on it. An
object based on Property Class can inherit the setting of any property in the class that is
valid for that object. When you make changes to the property class the changes are
reflected across all the objects that have inherited that class. Thus we can say that Form
Builder possesses Object Oriented features like inheritance Property class Inheritance is a
powerful feature that allows you to quickly define objects that conform to your interface
and functionality standards.

Inheritance is a relationship between objects such that the child object has all the property
settings of the parent object plus whatever additional ones that makes it a different.

You are already aware that for every Form Object the properties are defined in the
Property palette for that Object. You can assign values to these properties, say for
example Enabled, Displayed are properties of an object, whereas the values that you can
assign to them are 'True' or 'False'. You can create a Property Class and add the required
properties to it, and then assign values to it. Keep in mind that the object does not get all
the properties from the property class, just the values for the ones it already supports.
Thus you can say that a Property Class supplies initial values for the properties which
you can override to customize the object to your needs.

You can create a huge property class and then apply the property settings of the class to
the different types of objects. For example, a property class might contain properties that
are common to all types of items, or that, which apply only to radio groups, or apply only
to check boxes.

A Property Class itself can be based on another property class. Property classes allow you
to make global change to applications quickly by simply changing the definition of a
Property Class, you can change the definition of all objects that inherit properties from
that class.

6.2 Creating a Property Class


Property Classes can be defined in a form module as well as in a menu module. In the
Object Navigator, pr operty classes appear as a separate node.

Property classes can be created in two ways, through


D2K For ms Builder

Ø The Object Navigator


Ø The Property pallette

Steps to create a property class through the object navigator:

1. In the Object Navigator, position the cursor on the Property Classes node and click on
the ‘+’ create button in the toolbar.
2. A property class object with a default name is inserted under the node. Open the
property palette of this class and you see that new property class does not contain any
properties.

Figure 6-1: Property Palette (Property Class)

3. In the Property palette, add properties to the class as desired

Example
To create a Property Class for push buttons

1. In the Object Navigator, create a property class object


2. In the property palette of the property class object, click on the Add Property icon on
the top horizontal bar. A Lov with all the properties available will be displayed. From
this Lov, you may choose the following settings for a property class,

Name: Button_Class
Item Type: Button
Canvas: <Canvas Name>
Enabled: True
Navigable: False
Mouse Navigable: False
Iconic: True
3. Select the property palette of the object to which the class is to be inherited. Select the
D2K For ms Builder

Subclass Informatio n property under the General nod_. The subclass Information
window is displayed. Choose the Property Class option and enter the appropriate
property class name and the module name to which the property class belongs. The
modules that are open will be seen in the list of modules.
4. A sign besides the property indicates that it has been inherited

Figure 6-2: Subclass Information Dialog

Steps to create a Property class from the Property Palette:

Ø Select all the properties under one property group. Remain in the property palette.
Ø Click on the Property Class icon on the top horizontal tool bar. Forms builder will
notify the user that it has created a Property class with the selected property settings.
You can new base other objects on this class.

Creating a property class in this manner is faster than the previous method.

Example

To create four stacked canvases of the same size (width and height) and their x and y co-
ordinates also must coincide such that they overlap each other. So only one canvas is
visible at any point of time.

Ø Create a stacked canvas


Ø Set the property settings for it.
Ø Create a property class with the same settings.
Ø Now create three other canvases and inherit the settings of this class into them.

After inheritance the properties of the object can be either in an Inherited state or in a
Variant state.

A sign beside a property of the inherited object indicates that the property is
in an inherited state, which means the settings of the class from which it inherited the
property shall prevail runtime.
D2K For ms Builder

The setting of the new property can be made to override the inherited one, in which case
there will be sign and the settings of the individual property shall prevail.

Hence, once the object is based on a property class, you can modify its definition and
properties as follows,

Set the properties as desired by overriding the inherited value to variant


Add or remove properties
Base the object on another property class
Disassociate the object by setting the class to <Null>

To convert the property setting of an object from variant to inherited click on the Inherit
icon on the top horizontal tool bar in the property palette of that object.

The toolbar provides quick access to commands. Click once on the icon for the command
you want to execute. The Toolbar shown in the previous figure is explained below:

Copy Properties: Copies the property settings currently displayed in the Property
palette to the clipboard
Paste Properties: Pastes the clipboard property settings to the list of properties in
the Property palette. Properties that are on the clipboard but
not in the property list are ignored.
Add Property: Displays a list of values (LOV) from which you can choose a
property to be added to a property class. This command is
available only when you try to create the Property Class object
through the Property Class node in the object Navigator.
Delete Property: Removes the property currently selected in the property list. This
command is available only when you try to create the Property
Class object through the Property Class node in the object
Navigator.
Property Class: Creates a property class from the list of properties currently
displayed in the palette. The new property class object is inserted
under the Property Classes node in the Navigator and assigned a
default name
Inherit: Sets the current property to its default setting. If the property list is
based on a property class that includes the current property, the
default setting is the setting defined in the class. If the current
property list is not based on a property class or is based on a class
that does not include the current property, inherit sets the property
to the oracle forms default. (Inherit -sets the property to the forms
default for string values only, not for complex values).
Intersection/Union: Toggles the Property palette between union and intersection
display modes. This option determines which properties appears
when more than one object is selected at a time (a multiple
selection). In intersection mode (the default), only properties that
D2K For ms Builder

the selected objects have in common are displayed in union mode,


the properties of all objects in the current selection are displayed.
Freeze/Unfreeze: Toggles Property palette synchronization On and Off. When
Freeze is Off (the default), the property list is updated to display
the properties of objects you select in the Navigator and other
windows. When Freeze is On, the property list is pinned and does
not get updated.

6.3 Defining Triggers in Property Classes


It is possible to define triggers under property classes. When an object based on a
property class, inherits a trigger, it executes the trigger in response to the triggering event,
just as it would if you had attached the trigger to the object directly.

However, if the object itself has a similar trigger owned by it then the trigger attached to
the item would take precedence over the trigger that was defined with the property class
at runtime.

Step to define triggers in property class:

Ø In the Object Navigator, click on the Triggers node under the property class
Ø Click the create ‘+’ button in the toolbar
Ø Select the desired trigger from the LOV
Ø The PL/SQL Editor appears, showing the trigger you selected.
Ø Enter and compile the desired trigger code, then Close the editor
Ø The new trigger appears under the Trigger node for the property class

6.4 Introduction to Visual Attributes


Visual attributes include font, color, and pattern properties that you set for form and
objects that appear in your application. You can specify the visual properties of an item
with the properties specified under the Fonts & Color node in the property palette of the
item. You can specify the individual attribute setting like Font Name, Font Size etc. or
attach a visual attribute group to the item. It determines object's individual Visual
attribute settings, the look and feel (Font Size, Foreground Color, etc.).

Look at the Fonts & Color node in the property palette of an Item.
D2K For ms Builder

Figure 6-3: Setting visual attributes in Property Palette

Visual attributes encompass the following properties

Ø Font properties: Font Name, Font Size, Font Style, Font Width, Font Weight. Color
and pattern properties: foreground Color, Background Color, Fill Pattern, and White
on Black.
The Visual attribute group property specifies how the object's individual attribute
setting are derived. The following settings are valid for this property.
Ø Default
When Visual Attribute Group is set to Default, the individual attribute settings are
determined by a combination of factors, including the type of object, the resource file in
use, and the window manager.

An item that has Visual Attribute Group set to Default, or that has individual attribute
settings left unspecified, inherits those settings from the canvas to which it is assigned.
Similarly, a canvas that has Visual Attribute Group set to Default, or that has individual
D2K For ms Builder

attribute settings left unspecified, inherits those settings from the window in which it is
displayed. Visual attribute settings derived through window -canvas or canvas -item
inheritance are apparent only at runtime, not at design time.
Ø Named Visual Attribute
Specifies a named visual attribute that should be applied to the object. A named visual
attribute is a separate object in a form or menu module that define a collection of visual
attribute properties. Once you create a named visual attribute, you can apply it to any
object in the same module. When Visual Attribute Group is set to a named visual
attribute, the individual attribute settings reflect the attribute settings defined for the
named visual attribute object.

6.5 Creating Named Visual Attribues


Ø In the Object Navigator, position the cursor on the Visual Attributes node
Ø Click the create '+' button in the toolbar
Ø Form Builder creates a new named visual attribute object
Ø In the Property palette, set the font, color and pattern attributes of the name, visual
attribute as desired
Ø Apply a named visual attribute to an object
Ø In the Object Navigator or the layout editor, selected the desired object
Ø In the Property palette, set the Visual Attribute group property to the name of the
desired visual attribute object
Ø Set the Visual Attribute group property to the name of the desired visual attribute

6.6 Changing the visual attribute of an object at runtime

If Get_Item_Property('Block.Item', Visual_Attribute) <> 'DEFAULT' Then


Set Item_Property('Block.Item' ,Visual_Attribute,'my_attribute');
End if;
D2K For ms Builder

7 Form Objects

7.1 Editors

There are occasions when you need to create or maintain long strings of characters in
your application. But it becomes difficult for the user to view the entire contents of the
field and he has to scroll through it. In such cases he can make use of Editor, Which can
also provide basic editing tools such as search and replace, or cut and paste.

7.1.1 Types of Editors

1. Default
2. System
3. User named

Default Editor
This is Forms internal editor. It provides standard-editing features, is built into every
form and is automatically available from every text item.

System Editor
If there is a system editor available you can specify that Form Builder use this editor in
Windows environment this editor is the Notepad Editor.

User Editors
It is an object that you can create from the object navigator. Because it is a named object
you can specify Editor attributes such as title, position, size, visual attribute. It can be
displayed programmatically with the SHOW_EDITOR built-in. The Show_Editor built-
in can be used not only to specify the location at which you want to display the editor, but
the source and destination of text can also be specified. You can invoke it from one or
more text items.

7.1.2 Invoking the Editors

1. Invoking Default Editor:

You can invoke the default editor by using Edit -> Edit from the runtime menu. It can be
displayed programmatically by executing the EDIT_TEXTITEM built-in.

e.g.

Create a form having a block based on Customer table. Since it has a field comments that
D2K For ms Builder

has long strings of chara cter, we will attach our editor to this field.

Trigger Name: When-new-item-instance of comments field

Trigger Text: Begin


Edit textitem;
End;

Built-in
Edit_TextItem
Syntax:
Edit_TextItem;
Edit_TextItem (x NUMBER, y NUMBER);
Edit_TextItem (x NUMBER, y NUMBER, width, NUMBER, height NUMBER);

e.g.

Edit_TextItem(100,100,140,135);
Parameter x specifies x coordinate to place the editor
Y specifies y coordinate to place the editor
Width specifies the width of the entire editor window
Height specifies the height of the entire editor window

2. Invoking the System Editor

To invoke the system editor open the property sheet of the desired text item and set the
property to SYSTEM_EDITOR by selecting SYSTEM_EDITOR from the Editor
property poplist.

You can also specify the editor's display co-ordinates by setting the Editor X position and
Editor Y Position properties.

You will invoke the System editor in the same manner as you invoke the Default Editor
by using Edit- Textitem built -in.

7.1.3 User defined Editors

Creating User Defined Editors

You can create the user defined Editor through the object navigator as follows:

1. Highlight the editor node and choose Navigator -> Create


2. Go to the property sheet of the editor and set its different properties such as name,
x & y position etc.
3. Go to the property sheet of the text item to which you want to attach the editor
and set its editor property to the name of the editor just created.
D2K For ms Builder

To invoke the User-defined Editor

The Custom Editors have an additional feature. You Use the Show_Editor built-in not
only to display the user named editor at the location you want, but also specify the source
of the text (message_in), and the destination of the contents of the dialog box
(message_out), when user dismisses it by pressing Ok.

Syntax
Show_Editor(editor_name, message_in, x, y, message_out, result);

The result parameter is a Boolean IN OUT parameter. If the operator accepts the editor,
SHOW_EDITOR sets result to TRUE, and sets message_out to the current text string. If
the operator cancels the editor, SHOW_EDITOR sets result to FALSE, sets message_out
to NULL.

Syntax
SHOW_EDITOR(editor_id, message_in, message_out, result);
SHOW_EDITOR(editor_id, message_in, x, y, message_out, result);
SHOW_EDITOR(editor_name, message_in, message_out, result);
SHOW_EDITOR(editor_name, message_in. x, y, message_out, result);

Description
Displays the given editor at the given co-ordinates and passes a string to the editor, or
retrieves an existing string from the editor. If no co-ordinates are supplied, the editor is
displayed in the default position specified for the editor at design time.

Parameters
Editor_id: Specifies the unique ID that Form Builder assigns when it creates the
editor. Use the FIND_EDITOR built-in to return the ID to a variable of the
appropriate data type. The data type of the ID is Editor.
Editor_name: Specifies the name you gave to the editor when you define it.
Message_in: Form item that displays text into editor.
Message_out Form item where the typed string must be sent.
X, Y Position: It's optional to specify these parameters.
Return value: is of Boolean type.
True If editor was accepted. False: If editor was cancelled

e.g.
After a query operation the value of comments field is passed to variable ‘var’ the Editor
is then Displayed. If the operator makes modifications to the Comments then the item is
updated.

Trigger: When-New-Item-Instance of Comments


DECLARE
Ed_id Editor;
D2K For ms Builder

Ed_name VARCHAR2(40);
Val VARCHAR2(32000);
Ed_ok BOOLEAN;
BEGIN
Ed_name:= 'my_editor1' ;
Ed_id := Find_Editor( ed_name );
Val := :Customer.comments;
Show_Editor( Ed_id, val, 10,14. val, Ed_ok);
IF Ed_ok THEN
:Customer.comments := val;
END IF;
END;

The visual attributes used by the default editor are default attributes of Form Builder. If
you want to make it look consistent with your application then create an Editor Object
and set its Properties in the Property Palette.

e.g.
1. Create an editor in object Navigator
2. Set its Visual Attribute Name Property to a Visual Attribute already created by
you.
3. Set the title Property. You can also specify a bottom Title, Scrollbars for the
dialog box.
4. Attach the editor to the desired text item

7.2 Timers
A Timer is an internal clock created at runtime only and can be re-initialized on its
expiry. A Timer is a programmatic construct, which you can create, modify or delete.
When you create or modify a timer, you can specify the time, which elapses before the
timer expires. Using the When-Timer-Expired trigger, you can specify what actions must
be performed at that time.

7.2.1 Creating a timer


Use the Create_Timer built-in to create the timers programmatically

Syntax
Create_Timer (timer_name, milliseconds, iteration);

e.g.

Create_Timer('my _timer' ,1000, REPEAT);

This statement when executed will create a timer named 'my_timer' which will expire
D2K For ms Builder

after 1000 milliseconds i.e. 1 sec. The iteration parameter can take two values REPEAT
and NO_REPEAT. If REPEAT is specified the timer will repeat upon expiration of this
timer. If NO_REPEAT is specified then the timer will not repeat once it expires.

e.g. no 1
To create a timer at form start-up which expires every 10 secs to display a message.
TRIGGER NAME: PRE -FORM
Trigger Text;

Declare
time_id timer;
Begin ,
time_id := create_Timer( 'my_timer',10000,_REPEAT);
if Id_ Null(time_id) then
Message('Error in creating timer');
Raise form_Trigger_Failure,
End if;
End:

Trigger Name: When-Timer-expired


Trigger Text
Begin
Message (‘Time Elapsed : 10 Seconds !’);
End;

A When-Timer-Expired trigger does not fire during a navigation or transaction


processing in the form. It does not fire when user is currently navigating a form.

e.g. no 2
To display a running clock in the form
Trigger Name When-New-form-Instance
Trigger Text
Declare
Timer_id timer,
Begin
Timer_id := Create_timer (‘clock’,1000,repeat);
End;

Trigger: When-Timer-Expired
/*Create a control block named control_block having run_clock as a text item*/
If Get_Application_Property(Timer_Name) = 'CLOCK'
then
:control_blk.run_clock:=To_char(sysdate,'HH:MI:SS');
end if;
D2K For ms Builder

7.2.2 Multiple Timers

If your application contains multiple timers, use the Get_application_Property ( ) to get


the name of the most recently expired timer. This built-in can be used in When-Timer-
Expired trigger to perform actions according to the expired trigger.

e.g.
Declare
Tm_name varchar2 (30);
Begin
Tm_name := Get_Application_Property(Timer_Name);
If tm name = 'Timerl' then
…Do… this…;
Else Tm_name = 'Timer2 ' then
…Do… this…;
End If;
End;

7.3 List of Values (LOV)


It is a scrollable window (Modal) that provides a single or multi-column list of value it
can be displayed at users request or programmatically. LOV's are a special type of single
selection lists that can be used with very little effort to display data to the users and allow
them to pick the desired element. LOV's are combination of modal dialog boxes, lists and
record groups, therefore they have characteristics from each of this objects. The user can
select the desired value from the LOV and the value is assigned to the item or the object
to which it is attached. It can be attached to one or more text items. Record Groups are
internal data structures similar to that of database table when you create an LOV, the
record group gets created automatically. A single record group can be attached to a
number of LOVs. An LOV can be created at design only.
D2K For ms Builder

Figure 7-1: LOV (Runtime) (Selection of Manager)

7.3.1 Creating a Lists of Values

1. Highlight the LOVs node in the object navigator and select Navigator -> Create from
the menu
2. The following dialog will be displayed:
Ø If you want to attach an existing record group, you can browse through the
record groups that exist in Form module, by clicking on the SELECT button.
Ø If you want to create a record group based on a query, you can do so by entering
the Query in the Query text column
3. Click on the OK button to create the LOV.
If you have written a query in the Query Text you will see that along with the LOV a
Record Group is also created. After creating an LOV it can be attached to an item.
D2K For ms Builder

Figure 7-2: New LOV Dialog

7.3.2 Attaching an LOV to an Item

Open the Property sheet of an item and set the following Miscellaneous settings:

LOV: <Lov name>


LOV X position: <X position where you want the LOV to be displayed>
LOV Y position: <Y position where you want the LOV to be displayed>
LOV For Validation: If set to True, Forms validates the Text item against the values in
the LOV to which it is attached. It compares the current value of
the item with the value in the first column displayed in the LOV.

7.3.3 Specifying the Return Values

To specify the return values i.e. the text item to which the value from LOV should be
entered, open the property sheet of the LOV and select the Column mapping Property.
The following dialog is displayed. Enter the name of the item in the Return item column
and set the width appropriately.

The Return Value specifies the name of the form item or variab1e to which Form Builder
should assign the column's value whenever the operator selects an LOV record. A return
item-can be a form object, a global variable or a form parameter.
D2K For ms Builder

Figure 7-3: LOV Column Mapping

7.3.4 Displaying LOV

To display an LOV during a runform session after attaching it to a text items. You can
simply run the form, when you navigate to the item, the status bar displays a message
showing <List Of Values>, which indicates that a list is attached to that item. Choose
Edit ->Display List from the runform menu to view the list.

Or you set the LOV's Auto-display property to True, Form Builder displays the LOV
automatically when the operator navigates to the text item.

To display the list programmatically you can write a trigger or user-named routine that
executes the SHOW_LOV or LIST_VALUES built-in subprogram.
D2K For ms Builder

Figure 7-4: Displaying LOV at Runtime

7.3.5 Built-ins and their use

List_Values
It can be used when current item has an LOV attached. It can be called in the When-New-
Item instance trigger.

LIST_VALUES (kwd NUMBER);


Kwd Specifies one of the following constants:

NO_RESTRICT
Form Builder will not use the automatic search and complete feature.

RESTRICT
Form Builder will use the automatic search and complete feature.

Show_Lov
D2K For ms Builder

It can be displayed irrespective of whether an LOV has been attached to an item or not. It
returns true of a selection was made and false if it was cancelled.

Syntax
SHOW_LOV (lov_id LOV);
SHOW_LOV (lov_id LOV, x NUMBER, y NUMBER);
SHOW_LOV (lov_name VARCHAR2);
SHOW_LOV (lov_name VARCHAR2, x NUMBER, y NUMBER);

Parameters
lov_id: Use the FIND_LOV built-in to return the ID to an appropriately typed
variable. The datatype of the ID is LOV.
lov_name: The name you gave to the LOV when you define it. The datatype of the
name is varchar2.
x: Specifies the X coordinate of the LOV.
y: Specifies the Y coordinate of the LOV

Because SHOW_LOV is a restricted built-in, when you use it to display an LOV. Form
Builder ignores the LOV’s Automatic Skip property.

If you want to move the cursor to the next navigable item, use the LIST_VALUES built-
in. LIST_VALUES is an unrestricted built-in.

7.3.6 Properties of LOV

There are several properties of LOV that govern the behaviour of the LOV’s objects at
runtime. You can set them in the Property Palette.

First you change the look of the LOVs dialog box – Visual Attribute Name property to
the desired choice (Create a visual attribute to attach it to the LOV).

You can set coordinates, title of LOV’s dialog box.

Other Properties

Automatic Select
If Auto confirm is set to ‘Yes’ the, when the list is reduced to one element through the
auto-reduction process, that element will be picked automatically without users having to
confirm the selection. (Default – False)

Automatic Display
If Auto display is ‘Yes’ each tome the focus is on the item to which the LOV is attached,
the LOVs dialog box is displayed. (Default – False)
D2K For ms Builder

Automatic Refresh
If the Auto Refresh is ‘Yes’ (default) means each time the LOV dialog box is invoked,
the query to which the record group is populated will be fired. If false the query is fired
only the first time the LOV is invoked.

Filter Before Display


If this property is set to ‘Yes’ each time the LOV dialog is invoked, a preliminary filer is
displayed where he users can display additional criteria to narrow the scope of the query.
(Default – False).

Automatic Skip
Moves the cursor to the next navigable item when the operator makes a sele ction from an
LOV to a text item. When Automatic Skip is set to No, the focus remains in the text item
after the operator makes a selection from the LOV.

7.3.7 Modifying LOV properties at Runtime


Properties of LOVs can be modified and retrieved dynamically usin g Get_Lov_property
and Set_Lov_property.

Set_Lov_Property
Syntax
Set_Lov_Property(‘Lov_name’, Property, value)

Parameters
Lov_name: Indicates the name of the LOV in quotes or the id of LOV without quotes.
Property: Indicates the name of property which is to be set.
Value: Indicates the value to which the property is to be set.

e..g – 1 To display the LOV

Declare
x boolean;
Begin
x := Show_Lov ('My_LovI);
End;

e.g. – 2
1. Create a form that has a block based on customer table. Let us try to query the form
based on the customer numbers. Paste a push button labeled ‘Select’
2. Create a LOV. The query Text column should have the following query:
Select custid from customer
Let the Return Value be :global.cno
3. Write the following code in the When-Button-Pressed of ‘Select’;
Declare
Lov Selected boolean;
Begin
D2K For ms Builder

Lov_Selected := Show_Lov('Cust_Lov');
If Lov_Selected then
Execute_query (No_validate) ;
End If;
End;
4. Pre-Query of Customer block
:customer.custid := :global.cno;

7.4 Alerts
Form Builder has many built-in alerts that display pre-defined messages. You can also
create your own custom alerts that display in response to application-specific events. Say,
for example you have to run a form but you have not connected after logging into forms
Builder Form Builder Brings up the 'Connect' dialog box.

Figure 7-5: Form Alert (Connection Request)

Alerts are internal Form Objects that when invoked at runtime are displayed as modal
dialog boxes. They are used to notify the user of some application condition. They may
be used to warn the user about some action, which might cause some undesirable
situation.

Form Builder has many built-in alerts that display pre-defined messages. You can also
create your own custom alerts that display in response to application-specific events.

It is a kind of dialog box that displays a message with an icon. Every alert must have at
least one push button and may have up to three buttons. Every other operation in the
application is halted until the alert is dismissed. Pressing one of its push buttons can
dismiss the alert.

7.4.1 Creating an Alert

The alert object has to be created at design time only.


D2K For ms Builder

Figure 7-6: Save Alert

Steps
Ø In the Navigator, select the Alerts node and then choose Navigator -> Create
Ø Go to the Properties window, set the Alert Style property to either Stop, Caution
message in the alert window.
Ø Set the Message property by entering the message you want the alert to display at
runtime. You can enter upto 200 characters.
Ø Define one or more buttons for the Alert by entering the text table in the Button 1
Label, Button 2 Label, Button 3 Label properties. Buttons that do not have labels are
not displayed. Default buttons are OK and Cancel.
Ø Choose the default Alert button Button 1, Button 2 or Button 3
Ø The default button is the button that is selected implicitly when the operator presses
[Accept]

7.4.2 Displaying the Alert

In order to display an Alert, it is necessary to execute the Show_Alert built-in


subprogram from a trigger or a user named subprogram. Show_Alert is a function that
returns a numeric constant.

X := Show_Alert(alert_name);
Where x is declared as a numeric constant
The constant returned by the Show_Alert function indicates the alert button, which the
operator selected and is one of the following:

ALERT_BUTTON1, ALERT_BUTTON2, ALERT_BUTTON3.

You can store the value of the returned constant like the above and perform an action
depending on the button pr essed by the user.

e.g.
To create an Alert that warns the user whether he really wishes to exit the application.
This alert may be displayed from the When-Button-Pressed trigger for ‘Quit’ Push
button.

Steps
Ø Create the Alert as usual from the Object Navigator
D2K For ms Builder

Ø Select the property pallete and give the following settings:


Name: Exit_Alert
Title: Exit Application
Alert_style: Caution
Button 1: Yes
Button 2: Cancel
Alert Message: There are Uncommitted changes. Save Now?
Ø In the When-Button-Pressed trigger of Exit Push Button
Trigger When-Button-Pressed
Declare
alert-id Alert:= Find_Alert (‘Exit_Alert' );
X Number;
Begin
If System.form_status=’Changed’ then
X:=Show_Alert(Alert_id);
If x = ALERT_BUTTONI then
Do_Key('Commit_Form’);
Do_Key ( 'Exit_Form');
End If;
End If;
End;
D2K For ms Builder

8 Record Groups

8.1 About Recordgroups

A Record Group is an internal Forms Builder data structure that has a column / row
framework and can be thought of as two-dimensional array if multiple data types.
Basically, they are sepa rate objects that belong to a Form module in which they are
defined. They can be created dynamically or at design time. A record group can have
unlimited number of columns of type Char, Long, Number or Date provided that the total
number of columns does not exceed 64K.

8.2 Types of Record Groups

There are three types of record groups:

1. Query record groups


2. Static record groups
3. Non-query record groups

Query record group


A query record group is a record group that has an associated SELECT statement. It
consists of columns and rows retrieved as a result of query associated with it. The
columns in the query record group derive their default names, data types and lengths
from database columns referenced in the SELECT statement. These record groups are
similar to the database view, with the added advantage that the record group is local to
Forms Builder, rather than existing in the database. It can be created at design time or at
runtime.

Static record group


Static record group is not associated with any query. It’s structure and values are defined
at design time and remain fixed. You cannot add or delete rows of such record group at
runtime.

Non-query record group


Non-query record group is not associated with any query. It can be created only at
runtime. Thus, it’s structure and values can be created only at runtime.
D2K For ms Builder

8.3 Record Group Sources


The values in the record groups can come from the following three sources:

1. Execution of query (in case of query record groups)


2. An array of static values defined at design time (Static record groups)
3. Assigning the values at runtime by using built-in functions and then populating the
group dynamically (Query and Non-query record groups)

8.4 Creating Record Groups

At Design Time

In Navigator, select Record Groups node and click on create ‘+’ button in the toolbar.
The following New Record Group Window will be displayed.

Figure 8-1: New Record Group Dialog

Query Record Group


In case of Query record group, enter the query or the select statement in the Query Text.
Click on OK. A Record Group with appropriate columns is created. To view the
structure, go to the Functional node in the Property Palette of the record group and click
on Column Specifications property. The Column Specification window (figure 2) will
display the structure of the record group. To modify the query, enter the new query in the
Record Group Query property under the Functional node in the Property Palette.
D2K For ms Builder

Static record group


In case of Static record group, choose Static values and click on OK. The Column
specification window will be displayed. Fill in the names of the columns, their types and
the values.

Figure 8-2: Column specifications

At Runtime
Query record group

Let us create a query record group at runtime. The following code generates a record
group named ‘RG1’ and populates it.

Declare
Rg_id recordgroup;
Err_cd number;
Begin
Rg_id := create_group_from_query(‘RG1’, ‘select emp_no ‘ | | ‘, ename from emp’);
Err_cd := populate_group (rg_id);
If Err_cd < > 0 then
Message (‘Cannot populate the record group’);
End if;
End;

In the declaration part of the code rg_id has been defined to be an item of type
recordgroup. The CREATE_GROUP_FROM_QUERY built-in creates a record group
and returns the object id of type recordgroup. The CREATE_GROUP_FROM_QUERY
D2K For ms Builder

built-in takes four parameters.

The syntax is
CREATE_GROUP_FROM_QUERY(recordgroup_name,
Query,
Scope,
Array_fetch_size);

Where recordgroup_name is the name of the record group being created. Query is a valid
SQL SELECT statement, enclosed in single quotes. Scope specifies whether the record
group can be used within the current form or with every form in a multi-form application.
Takes the following constants as arguments.

Ø FORM_SCOPE – indicates that the record group can by used only within the current
form. This is the default argument.
Ø GLOBAL_SCOPE – indicates that the record group is global, and that it can be used
within all form in the application. Once created, a global record group persists for the
remainder of the runtime session.

Array_fetch_size specifies the array fetch size i.e. the number of records that will be
fetched at a time. The default array size is 20.

We have nit supplied the scope and array_fetch_size parameters as they are not the
required parameters and have default values.

Initially the record group does not have any rows. To populate the group with data the
function POPULATE_GROUP built-in is used. It returns 0, if successful or the oracle
error code, if it fails. Next we check the value returned by POPULATE_GROUP built-in
and display the message “Cannot populate the record group’ in case the group has not
been populated with records.

Non-que ry record group


Now let is create a non-query record group at runtime. The following code illustrates the
creation of a non-query record group.

Declare
Rg_id recordgroup;
Col_id groupcolumn;
Begin
Rd_id := create_group ( ‘RG1’ );
Col_id := add_group_column (rg_id, ‘DNAME’, CHAR_COLUMN,20);
Add_group_row ( rg_id, END_OF_GROUP);
End;

To create non-query record group use the CREATE_GROUP function. This function
creates a record group, which does not have any rows or columns and returns the object
D2K For ms Builder

id of type recordgroup. Use ADD_GROUP_COLUMN to add a new column before


adding a row.

8.5 Using Record Groups


Record Groups can be used to do the following:

1. Constructing Dynamic SELECT statements


The SELECT statement on which the record group is based can be constructed
programmatically at runtime. This feature can be used to create generic program units.

2. Communicating within a form


We can say that a record group is a structure data type, so we can use it to exchange data
within a form and between multiple forms.

3. Passing record group data to other Oracle Products


You can pass bulk data in form of record group from Form Builder to other Oracle
products like Report Builder and Graphics Builder (Use the RUN_PRODUCT built-in).
This eliminates the need to perform the que ry used to retrieve data in the other Oracle
products, if Form Builder has already executed it.

4. Populating or storing List items


You can transfer the values of a record group to a list item. You can create Record Group
on dynamically constructed SELECT statement; this ability gives you the opportunity to
create dynamic list items. The data transfer is bi-directional; you can also transfer the
values of a list item to a record group.

Example
1. To create a dynamic list item
Ø Open a New form
Ø Create a block base d on EMP table
Ø Create a query record group at deign time that contains the name of
departments and department numbers. The property sheet of the record
group is as follows.
D2K For ms Builder

Figure 8-3: Property Palette (Record Group)

2. Convert the text item DEPTNO into a list item

Ø Populate the list item dynamically at runtime, using the design-time query record
group. For this write the following trigger code.
Trigger: When-New-Item-Instance on Deptno

Declare
List_id item;
Rec_grp recordgroup;
begin
list_id := Find_item (‘Emp.Deptno’);
rec_grp := find_group (‘RG2’);
If populate_group(rec_grp) = 0 then
Populate_list(list_id, rec_grp);
Else
Raise Form_trigger_failure;
End If;
End

In the above code we first populate the already created record group RG2. if
Populate_group has been successful in fetching the records we populate an item of type
List item (Combo Box) with the record group using the Populate_list built-in.
populate_list removes the contents of the current list and populates the list with the values
from a record group. If Populate_List is not successful then we are raising the
D2K For ms Builder

Form_trigger_failure exception. The FORM_TRIGGER_FAILURE exception of a


predefined PL/SQL exception available only in Form Builder. Because it is predefined,
you ca raise this exception without having to first define it in the declarative section of a
trigger or user-named subprogram.

Ø Save and run the form.


D2K For ms Builder

9 Canvases & Windows

9.1 Introduction

A canvas is a surface – inside a window, a container – on which you place the interface
items that end users interact with when they run the form. Canvas views are the
background objects on which interface items and boilerplate objects are placed.

Each item refers to exactly one canvas in its Property Palette. You can divide a data
block’s items between different canvases.

A canvas does not stand alone as an interface object. To see it and its items you must
display the canvas in a window, a rectangular area of the application display surrounded
by a frame. Developer/2000 makes these separate objects and lets you build windows that
provide a View of the canvas. A View is a rectangle within the windows that covers all or
part of the canvas. The part of the canvas that you can see through the window is the
view.

When you create a form module, you work with various objects specific to form modules,
such as: windows, canvases, blocks and items. A window is, by itself, and empty frame.
Windows have a title bar and handles for interaction, allowing end users to scroll, move,
and resize the window. Items are interface objects that display information to end-users
and allow them to interact with the application.

In short, we can say that a canvas-view is similar to the canvas on which we paint,
whereas a window is like the frame in which we enclose the canvas.

9.2 Type of Canvas-Views

A canvas type defines how Form Builder will display it in the window to which it is
assigned. When you create a canvas, you specify its type by setting the Canvas Type
property.

There are five types of Canvas-Views:


1. Content
2. Tab
3. Stacked
4. Horizontal Toolbar
5. Vertical Toolbar
D2K For ms Builder

Content Canvas
A content canvas-view is a base view, which occupies the entire window on which it is
placed. There must be at least one content canvas-view for each window. A window can
have more than one content canvas-view, but only one will be displayed at a time, during
runtime.

Tab Canvas
A tab canvas is made up of one or more tab pages, which allows you to group and display
a large amount of related information on a single canvas object. Like stacked canvases,
tab canvases are displayed on top of a content canvas. Tab pages each display a subset of
the information displayed on the entire tab canvas. The tab canvas is a new type of
canvas that enables you to organize and display related information on separate tabs.

When the operator clicks the label area of a tab page at runtime, the tab page is brought to
the front of the tab canvas, obscuring all other tab pages on the tab canvas.

Tab pages have properties, and items placed on a tab canvas have tab canvas properties as
well as tab page properties. You can define a canvas to have a series of tab pages.
D2K For ms Builder

Figure 9-1: Tab Canvas placed on Content Canvas

Stacked Canvas -Views


A canvas you display on top of another canvas, usually containing some items in a group
separate from the items in the underlying content canvas. This means that, the content
canvas-view lies below the stacked canvas-view and hence, that part of content canvas is
not visible to the user at runtime. So stacked canvas-views are more often shown and
hidden programmatically. We can display more than one stacked canvas-view in a
window at same time.

Horizontal / Vertical Toolbar Canvas -Views


Toolbar canvas-views are used to create toolbars for individual windows. This can be
done by placing iconic control items in the canvas-views. Horizontal toolbars are
displayed at the top of the window, just under its menu bar, while the vertical toolbars
along the left side of the window.
D2K For ms Builder

About Views
Whenever you create a block Form Builder automatically creates a content canvas in the
Layout Wizard. You can also create a canvas in the object navigator by selecting the
‘Canvas’ header and clicking Create tool. You can set the ‘Canvas Type’ (default
Content) and the window that displays the canvas in the Property Palette for the canvas as
shown in the figure below.

Figure 9-2: Canvas Property Palette


D2K For ms Builder

You can control the display of the Canvas background through the View | Show Canvas
menu item, available when Layout Editor is active. You can also resize the canvas itself,
by dragging the Selection handle in the lower right corner of the canvas. To see this turn
on the View | Show Canvas menu item. You can also change the Width and Height
attributes in the Property Palette.

The View | Show View menu item lets you see the view. If you display the canvas in a
window, the view is the area of the canvas you would see.

Figure 9-3: Canvas & it’s View

Stacking Canvas
Steps

1. Create two Canvases Dept_canvas and another Emp_canvas. By default both Canvas
are of type Content.
2. Create two data blocks in the usual way (using the data block wizard)
3. First a Dept data block on the Dept_canvas and a Emp Data Block on the
Emp_canvas. Set up the master – detail relation between dept and Emp block.
4. Change the ‘Canvas Type’ property of Emp_canvas from Content to Stacked
5. Select Emp_canvas, Choose Tool -> Layout Editor. In the Layout Editor size the
view. To size the stacked view Choose View -> Show View (do not do this if the
D2K For ms Builder

option is already Checked). The Layout Editor displays the View as a 1-point black
rectangle with ha ndles, which you can resize. (Scroll downwards if the handles are
not visible) Drag the handles upward to reduce the size to a little larger than the frame
surrounding the data block.
6. In the Layout Editor Choose View -> Show Canvas (do not do this if the option is
already Checked). Size the canvas following the method followed for sizing rge view.
Keep the size of the canvas a little more than the View or equal to the view.

If you want to see where the Emp_canvas canvas will be stacked during runtime.
1. Select the Dept_canvas from layout Editor.
2. From the menu select View -> Stacked Views. Select Emp_canvas from the list of
stacked canvases displayed. Clic O.K.

Figure 9-4: Stack Canvas on Content Canvas

3. The Canvas overlays the Content canvas

In the Property Palette (Emp_canvas) under the ViewPort Node property


ViewPort X (Col) Position by default has value 0
ViewPort Y (Col) Position by default has value 0
To Position the stacked canvas partly overlaying the content canvas, changing these x, y
coordinates places the stacked canvas on a location other than 0, 0.

ViewPort X Position : 25
ViewPort Y Position : 25

In other words the above properties set the coordinates at which the Emp_canvas should
be stacke d on content (Dept_canvas)
ViewPort Width is the width of the view
ViewPort Height is the height of the view
D2K For ms Builder

(In the layout editor with stacked canvas selected, open property palette of the canvas
keeping both open, in the status bar in the layout editor you can actually see the x and y
position of the view (lower right corner).

ViewPort X position on Canvas and ViewPort Y position on Canvas under the Physical
node in the property palette of the canvas are used to set the position of the canvas where
it should be displayed with respect to the window.

For content or toolbar canvas-views, the view size is determined by the size of the
window.

Figure 9-5: Placing Stack/Tab Canvas on Content Canvas

The final step is to tell Form Builder when to show the stacked canvas. Ordinarily, you
show the canvas and its window by navigating to an item on that canvas. This has the
effect of making the stacked canvas appear and disappear when you navigate to and from
items on it.

In our e.g. we want to navigate to the dept block, not to an item on the Emp_canvas but
you still want to see the stacked canvas every time you navigate the dept block then
D2K For ms Builder

In the When-New-Form-Instance Trigger write the following code:

Show_View (‘Emp_Canvas’);

If the stacked canvas needs to be displayed when required only, then, in the Dept_canvas
create a puch button Emp_details as shown

Figure 9-6: Dept Block on Content Canvas

Figure 9-7: Canvas, View & Frame

9.3 Windows

As described earlier, window is like a frame on which the canvas-view are placed. The
frame provides a title bar and a handle for interacting with the window. It is necessary to
have atleast one content canvas on a window. There can be any number of windows in a
form. Every new form contains a window named WINDOW1 by default.

MDI Window
Forms supports MDI (multiple document interface) system of windows management.
MDI applications display a default window called application window. The Windows
manager automatically creates a MDI (multiple document interface) window at runtime.
This type of window does not come in the forms list of window styles, since it is created
at runtime. The name of the MDI Window is FORMS_MDI_WINDOW.
D2K For ms Builder

9.3.1 Types of windows

There are two types of windows:

Document:
A Document window is always displayed within the framework of the application
window. If the size of the application window is less than the document window, you
specify its modality by setting the Modal property to True or False. The default is False,
which creates a modeless window.

Dialog Windows:
A Dialog window is a mobile window. We can move it out of the application window, if
we have defined it as movable (i.e. settings its movable property in property sheet to
true). The dialog window does not get clipped even if the size of parent window is less
than it is.

9.3.2 Modal and Modeless Windows

Depending on modal property of the Windows we can distinguish windows as modal


windows and modeless windows. When you create a window, you specify its modality by
setting the Modal property to True or False. The default is False, which creates a
modeless window.

Modeless Windows
1. More than one modeless window can be displayed at the same time
2. Modeless windows can also be layered to appear either in from of or behind other
windows
3. Modeless windows can remain displayed until they are dismissed by the operation
or hidden programmatically.
4. You can set the Remove on Exit property for a modeless window to specify
whether it should remain displayed when the operator navigates to another
window.
5. You can set the properties of a modeless window to specify its border and title
and whether operators should be allowed to scroll, resize, move, close, iconify,
and zoom the window

Modal Windows
1. Modal windows are usually used dialogs
2. Modal windows cannot have scroll bars, and setting the Scroll Bar properties for a
modal window has no effect
3. The Remove on Exit property doe s not apply to modal windows. By default,
Form Builder prevents operators from navigating out of modal windows with the
mouse, but does not allow them to navigate to another window with keyboard
commands. When such navigation occurs, Oracle Forms always closes the modal
window, unless the target window is itself a modal window
D2K For ms Builder

10 Object Groups

10.1 Introduction

An object group is a container for a group of objects. Related objects are packed together
in an object group, which can then be copied or reference in another module. Thus, object
groups enable us to implement reusability.

For examples, all the data entry forms have to be provided with common facilities like
adding, deleting, saving a record etc. Instead of creating these buttons for these activities
and writing various triggers on them, we can create push buttons for these activities in a
separate canvas/block an then include this in the object group. This object group can then
be referenced across the forms. Thus, with the help of object groups, we can reuse the
block as well as the contents of the block (items, triggers) and maintain consistency.

You can create object groups in Form and Menu modules. Once you create an object
group, you can add and remove objects to it as desired.

10.2 Creating an Object Group

In the Object navigator, position the cursor on the object Groups node and choose
Navigator -> Create. An object group with a default name in inserted under the node.
When you double-click to expand the object, the Object Group Children node appears.
Objects you add to the group appear under this node.

In the Object Navigator, drag the desired object(s) under the Object Group Children
node.

The screen figure 1 shows us an object group named ‘object_group25’. The ‘Ctl’ block is
a control block, whic h contains the iconic buttons. This block is assigned to a vertical
toolbar type of canvas-view ‘TOOL-CAN’. The block and the canvas view have been
dragged under the object group children node.
D2K For ms Builder

Figure 10-1: Object Group

10.3 Deleting objects from an object group

In the Object Navigator, select the object(s) you want to remove from the group and
choose Edit -> Cut, Edit -> Clear, or Navigator -> Delete. Removing an object from an
object group does not delete the object from the module.

10.4 Reusing the Object Group

To reference the object group created in one module from another module.

1. Open both the modules.


2. Drag the object group from one module and drop it on the object group node of
the other module.
3. A dialog appears, which asks whether you want to subclass or copy this object.
D2K For ms Builder

Figure 10-2: Subclass/Copy Dialog

10.4.1 Subclassing the object

Click on subclass to subclass the object group. When you subclass an object, you create
an object that inherits its functionality and appearance from another object. Subclassing
and the resulting subclassed object maintains a link to its source object. A subclassed
object automatically inherits any changes that have been made to the source object when
you open or recompile the module that contains the subclassed object unless both
modules are open. If both modules are open, changes are inherited immediately.

Subclassing allows you to:

Ø Create an independent subclass of any object.


Ø Automatically propagate any changes made to the source object to each
subclassed object.
Ø Override a subclassed object’s properties and structure.

Your final referenced object will look like this.


D2K For ms Builder

Figure 10-3: Subclassed Objects in Object Navigator

10.4.2 Copying the object

1. Click on Copy option.


One of the simplest ways to reuse an object is to copy it. When you copy an object,
you create a new and separate instance of the object, and any objects, owned by the
object being copied, are always copied automatically.

For example, when you copy a block, the new block includes any items that were
owned by the block and any triggers that were attached to the block or its items.

When a block is dragged into an object group, all objects that are owned by the block
(items, triggers, relations) are also included in that object group. But objects owned
by blocks cannot be placed in an object group independently of the block in which
they are defined. To include these objects in an object group, you must include the
block itself.

2. Program units cannot be included in an object group.

3. The objects in a group must all be defined in the same module. You cannot place
objects from two different forms in the same object group.
D2K For ms Builder

4. An object group cannot contain another object group.

5. When an object in an object group is deleted from a module, it is removed from the
object group automatically.

6. Deleting an object group from a module does not delete the objects it contains from
the module.

7. Object groups do not store copies of the objects they contain, but rather pointers to
the objects. The size of the module does not increase substantially, even though
object groups might be defined in it.
D2K For ms Builder

11 Multiple Form Application


Form Builder is a development tool that allows you to incorporate many useful features
in your database applications. It is also a flexible tool because it can be integrated
effectively with other Developer/2000 development tools. From Form Builder you can
run reports using Report Builder or display charts using Graphics Builder.

Form Builder is a development tool that allows you to create applications with multiple
blocks, windows. Many a times a need arises, when the func tionality of a system must be
split into different subsystems. Each of these subsystems may be further divided into
smaller systems, which are implemented as separate Form modules. In development
efforts for large enterprise systems, you need to create and maintain separate modules,
which are later on integrated, in larger systems. In these systems, a module that
represents the most important part of functionality is usually launched first. The users can
invoke the other modules as and when needed.

A multiple-form application is one that is designed to open more than one form during a
single Runform session. When the runform session is invoked to run a form, Form
Builder looks for the form in the appropriate directory and then loads it into memory
form, which is being executed. These forms can, in turn, invoked still other forms. When
one form programmatically invokes another, Form Builder looks for the new form in the
appropriate directory and then loads it into memory.

When you deliver a multiple-form application to end users, all >FMX, .MMX, and .PLL
(form, menu, and library) files that will be called during the session must reside in the
working directory.

11.1 Invoking Forms


There are three built-ins that can be used to programmatically invoke another form in a
multi-form application:

Ø Open_Form
Ø Call_Form
Ø New_Form

11.2 Open_Form

This is a procedure to open an independent form. When one form invokes another form
by executing OPEN_FORM, operators can navigate between the forms as desired. An
opened form can share the same database session as the form from which it is invoked, or
D2K For ms Builder

it can create a separate session of its own.

Calling Open-Form leaves the current form accessible but replaces the current menu with
the called forms menu.

You can navigate to items in other forms either with the mouse OR with the Go_Form,
Next_Form and Previous_Form built-in subprograms. While navigating Developer/2000
does no validation and fires no triggers other than the When-Window -Deactivated trigger
on the current form and the When-Window-Activated trigger and When-Form-Navigate-
trigger on the target Form.

Use a When-Form-Naviagte trigger to perform actions when any cross form navigation
takes place without relying on window activate and window deactivate events.

When you specify the ACTIVATE parameter, Open_Form gives the called form the
focus and ignores any statement following the Open_Form call in the calling PL/SQL
block. When you specify NO_ACTIVATE parameter, Open_Form keeps the focus on the
calling form and continues executing the statements following the Open_Form call.

If you use Open_Form, you can open the form in a new database session, and hence can
initiate a different transaction, by using the SESSION Parameter. Default is to Open the
form in the same session as the calling form. Opening separate forms in separate sessions
keeps your transaction separate so that you can deal with them independently. On the
other hand, if the forms use the same tables, you can get lock conflicts when both
transactions try to access the same tables at once. Separate sessions are most useful when
the forms do not share tables. NO_SESSION opens the form in the current session.

Syntax
Open_form (form_name);
Open_form (form_name, activate_mode);
Open_form (form_name, activate_mode, session_mode);
Open_form (form_name, activate_mode, session_mode, data_mode);
Open_form (form_name, activate_mode, session_mode, paramlist_name);
Open_form (form_name, activate_mode, session_mode, paramlist_id);
OPEN_FORM (form_name, activate_mode, session_mode, data_mode paramlist_name);

Parameter Description
Form_name Indicates the name of the form to be opened Open_form (‘my_form’);
Activate_mode It takes two values ACTIVATE and NO_ACTIVATE. ACTIVATE
sets focus to the form to make it the active form in the application
whereas NO_ACTIVATEE opens the form but does not set focus to
the form. The current form remains the active form. You can open a
form named ‘my_form’ from the running/current form in activate
mode as Open_form (‘my_form’, ACTIVATE);
Session_mode This parameter can take two values NO_SESSION and SESSION.
NO_SESSION option specifies that the opened form should share the
D2K For ms Builder

same database session as the current form. Hence, a COMMIT


operation in any form will cause validation and commit processing to
occur or all form running in the same session.
SESSION option specifies that a new, separate database session should
be created for the opened form. Two forms in different sessions is
same, as it would be for two independent forms with separate
connections.
Paramlist_name Specifies the name of a parameter list to be passed to the opened form.
We will be learning about parameters and parameter lists later on in
this chapter.
Paramlist_id Specifies the unique ID that Form Builder assigns to the parameter lists
at the time it is created.
Data_Mode NO_SHARE_LIBRARY_DATA (The default). At runtime, Form
Builder will not share data between forms that have identical libraries
attached (at design time).
SHARE_LIBRARY_DATA
At runtime, Form Builder will share data be tween forms that have
identical libraries attached (at design time).

Tips
When you open a form with ACTIVATE or NO_ACTIVATE option, then any start-up
triggers (lie pre-form) of the opened form that would normally fire will execute.
When you open a form with ACTIVATE option 9the default), the opened form received
focus immediately; trigger statements that follow the call to OPEN_FORM never
execute.
When you open a form with NO_ACTIVATE specified, trigger statements that follow
the call to OPEN_FORM will execute after the opened form has been loaded into
memory and its initial start-up triggers have fired.
Form Builder Runform must be running with the Session option turned ON when you
execute OPEN_FORM with the session_mode parameter set to SESSION. If the Session
option is Off, Form Builder issues an error and does not open the indicated form. This
option can be turned on by setting the environment variable FORMS45_SESSION /
FORMS50_SESSION (set in oracle.ini file) to TRUE. This setting enables multiple
sessions in Forms.

11.3 CALL_FORM

When you call one Form from another, the form which makes a call is referred to as the
parent form while the one which is called is referred to as the called form. A call to
CALL_FORM built-in loads the called form into the memor y (for its execution), but the
parent form also remains active i.e. the parent form does not release the memory
allocated. Form Builder runs the called form with the same Runform preferences as the
parent form. When the called form is exited Form Builder, processing resumes in the
calling form at the point from which you initiated the call to CALL_FORM. Till the
control is in the called form, you cannot navigate to the parent form. You have to exit the
D2K For ms Builder

called form to go back to the parent form.

Syntax
Call_form (form_name);
Call_form (form_name, display);
Call_form (form_name, display, switch_menu);
Call_form (form_name, display, switch_menu, query_mode);
Call_form (form_name, display, switch_menu, query_mode, data_mode);
Call_form (form_name, display, switch_menu, query_mode, paramlist_id);
Call_form (form_name, display, switch_menu, query_mode, paramlist_name);
Call_form (form_name, display, switch_menu, query_mode, data_mode,
paramlist_name);

Parameters
Parameters Description
Form_name Specifies the name of the called form. The name must be enclosed in
single quotes.
Display Takes any of the two values HIDE or NO_HIDE. HIDE is the default
parameter. It clears the parent form from the screen before drawing the
called form. When NO_HIDE option is specifies, Form Builder
displays the called form without clearing the calling form from the
screen.
Switch_menu Takes any of the two values NO_REPLACE or DO_REPLACE.
NO_REPLACE is the default parameter; when it is specified the
default menu of the parent form remains active for the called form.
When DO_REPLACE option is specified the called form retains its
own menu.
Query_mode Takes any of the two values NO_QUERY_ONLY or QURY_ONLY.
When the NO_QUERY_ONLY mode is specified the called form runs
in normal mode. In the normal mode you can insert, update and delete
the records from the called form. QUERY_ONLY option causes Form
Builder to run the indicated form in Query Only mode. In this mode
you can only query the data, but cannot insert, update or delete any
records.
Data_Mode NO_SHARE_LIBRARY_DATA (The default) At runtime, Form
Builder will not share data between forms that have identical libraries
attached (at designe time).
SHARE_LIBRARY_DATA At runtime, Form Builder will share data
between forms that have identical libraries attached (at design time)
Paramlist_id This is the unique ID, which Form Builder assigns to the parameter
list, when it is created. It specifies the unique ID Form Builder assigns
when it creates the parameter list.
Paramlist_name This is the name of the parameter list, which you create. This list
should consist of parameters of TEXT_PARAMETER type only.

This trigger does not fire when control returns to a calling form from a called form.
D2K For ms Builder

In a multiple-form application, this trigger does not fire when focus changes from one
form to another.

11.3.1 How Call_form works?

Say you have got two forms A and B, such that

A – Parent form
B – Called form

When Form A calls Form B, Form B becomes the active form in the session, but Form A
remains in me mory.

1. When you call form B from A, initially Oracle Form will issue a savepoint for form V
i.e. a savepoint is set for form B when it is called or started. So when B is the active
or current form and if a rollback is fired during its processing then all the
uncommitted changes get rolled back to the save point of form B. This means that all
the changed in formB will get rolled back but not the changes made to form A.
2. If form A is running in the QUERY_ONY mode, then form B will also run in
QUERY_ONLY mode irrespective of the query_mode poramter for form B.
3. Some memory allocated for CALL_FORM is not deallocated until the Runform
session ends. So be cautious, when creating a large stack of called forms.
4. When the calling form has pending updates or deleted that have not been posted or
committed, the called form runs in the post-only mode.

11.3.2 Difference between Posting and Committing

Using Call_Form or New_Form requires that you use commit or post data to the database
before calling the new form.

When we update, delete or insert any record Form Builder has to maintain the status of
the record and mark these records as changed, deleted or inserted. When a commit
operation is fired, Form Builder issues appropriate SQL statements to update, delete or
insert. It then issues a COMMIT statement to commit all these changes and make them
permanent onto the database.

Posting consists of writing updates, deletions, and insertions in the form to the database,
but not committing these transactions to the database i.e. these changed are not made
permanent. To only post the changes the POST built -in can be used. When the changes
are posted Form Builder need not maintain the status if the records.
D2K For ms Builder

11.3.3 Post-only mode

When the called form is running in the post -only mode, then the called form is allowed to
fire a commit. This is because if the commit is fired then the changes made to the calling
form also get committed. It is only allowed to post the changes. A form called from a
form running in post only mode also runs in post-only mode.

To avoid the form from running in post-only mode, explicitly post the changes made in
the calling form by using the POST built-in. execute this procedure just before making a
call to other form. After that whenever a commit is issued in the called form, the changes
made to the calling form are also committed.

If the called form is running in the post-only mode, then before exiting the form and
returning to the parent form, it is required to post the changes made in the called form.
After that whe never commit is issued in the parent form then the changes made to the
calling form as well as to the called form are posted.

11.4 NEW_FORM
The new_form built-in loads the new form into the memory after exiting the parent form.
It runs with the same preferences as the parent form. If the parent form has also been
called from another form then, the new form runs with the preferences of its parent (i.e.
you can say that the new form runs with the Runform preferences of its grandparent).

Syntax

New_form (form_mode);
New_form (form_mode; rollback_mode);
New_form (form_mode; rollback_mode; query_mode);
New_form (form_mode; rollback_mode; query_mode, data_mode);
New_form (form_mode; rollback_mode; query_mode, paramlist_id);
New_form (form_mode; rollback_mode; query_mode; paramlist_name);
New_form (form_mode; rollback_mode; query_mode, data_mode, paramlist_name);

Parameters
Parameters Description
form_name Specifies the formmodule of the called form. The name must be
enclosed in single quotes. The data type of the name is CHAR
rollback_mode This parameter can take three values TO_SAVEPOINT,
NO_ROLLBACK or FULL_ROLLBACK.
When the TO_SAVEPOINT option is specified Form Builder rolls
back all uncommitted changes (including posted changes) to the current
form’s savepoint.
D2K For ms Builder

When the NO_ROLLBACK option is specified Form Builder exits the


current form without rolling back to a savepoint. You can leave the top
level form without performing a rollback, which means that you retain
any locks across a NEW_FORM operation.
In the FULL_ROLLBACK Form Builder roll back all uncommitted
changes pending in the current session (including posted changes). This
includes changes made in the current form, posted changes made in
forms that called the current form, and posted changes made in forms
that were called by the current form. Full rollbacks are not allowed
when a form is in post-only mode.
query_mode Takes any of the two values NO_QUERY_ONLY or QUERY_ONLY.
NO_QUERY_ONLY runs the indicated form normally, allowing the
operator to perform inserts, updates, and deletes in the form.
QUERY_ONLY option runs the indicated form as a query-only form
i.e. inserts, updates and deletes are not allowed.
data_mode NO_SHARE_LIBRARY_DATA (The default). At runtime, Form
Builder will not share data between forms that have identical libraries
attached (at design time).
SHARE_LIBRARY_DATA At runtime, Form Builder will share data
between forms that have identical libraries attached (at design time).

11.4.1 How New_form works?

1. When a form is called through anothe r form by using the new_form built-in, the
calling form is terminated as the parent form.
2. Form Builder releases memory that the terminated form was using
3. If the calling form had been called by a higher form, i.e. if A. B, C are three forms
such that A calls B and B in turns calls C, the Form Builder keeps the higher call
active i.e. it’ll keep A active and treat it as a call to the new form C. So A will be
treated as parent to C.
4. Form Builder runs the new form with the same Runform options as the parent for m. If
the parent form was a called form i.e. form B in our example, Form Builder runs the
new form with the same options as the parent for i.e. of form A.

11.5 Closing Forms

There are three ways to close a form:


Close_Form : Close the Specified form equivalent to Exit_Form
Exit_Form : Close the current form corresponds to the Key-Exit trigger
Clear_Form : Rolls back and resets all forms in memory. It is equivalent to Action
_> Clear on default menu; corresponds to KeyClrFrm trigger.

The Call_Form and New_Form subprograms issue an ORACLE savepoint, Open_Form


does not. A savepoint is a point in the transaction to which you may roll_back without
D2K For ms Builder

rolling back the entire transaction. Creating a savepoint when you move to a different
form, gives you more control over what happens when the called form closes. If there is a
rollback and there is a savepoint, ORACLE only rolls the changes back to the point
before you called the new form, preserving all the changes you made and posted.

Exit_Form and Clear_Form have two parameters, the commit mode and the rollback
mode. The exit process first commits any changes based on the commit mode. The
commit mode can take any of the following values:

ASK_COMMIT :Ask the user whether to commit changes, then validate changes
and commit (default).
DO_COMMIT :Validate the Changes, commit and exit without asking the user.
NO_COMMIT :Validate the Changes, exit without commit
NO_VALIDATE :Exit without validating, committing or asking the user.

The rollback mode may have one of the following three possible values.

TO_SAVEPOINT :Roll back changes to the current form’s savepoint, then exit
(default)
FULL_ROLLBACK : Rollback changes to the beginning of the current transaction, then
exit.
NO_ROLLBACK :Exit without rolling back any changes. This values for rollback
mode is not supported in Clear_Form.

Example: Leave the called form, without rolling back the posted changes so they may be
posted and committed by the calling form as part of the same transaction.

BEGIN
Post;
/* Form_Status should be ‘QUERY’ if all records were successfully posted. */
IF :Systen.Form_Status <> “QUERY’ THEN
Message (‘An error prevented the system from posting changes’);
RAISE Form_Trigger_Failure;
END IF;
/* By default, Exit_Form asks to commit and performs a rollback to savepoint.
We’ve already posted, so we do not need to commit, and we don’t want the
posted change to be rolled back. */
Exit_Form(NO_COMMIT, NO_ROLLBACK);
END;

11.6 Parameters

When invoking a new module from an existing form, you may need to pass values from
the current environment to the new one. One way could be global variables, global
Variables are visible across all modules. If you need to initialize some values upon new
D2K For ms Builder

form’s startup, you can pass these values using parameter lists.

Within one module, variables can have local and global scope. Scope and visibility of
local variables does not extend beyond the program unit in which they are defined. The
global variables are visible throughout all active modules and accessible from all their
objects. Parameters implement different visibility and accessibility of certain data items
across the boundaries of the module. They are objects that are you used to pass data
between modules e.g. when a form calls another form or between products e.g. When an
Oracle Reports is executed from inside Form Builder.

11.6.1 Creating Parameters

A Form Parameter is an object that belongs to a Form. To Create one, Select the
Parameter node in the Object Navigator, and choose Create tool. In the property palette of
the parameter, set the desired values for name, datatype, maximum length, default value
and comment. You will be creating these parameters in the called form and these
parameters will receive the values from the parent form.

Figure 11-1: Parameter Property Palette

11.6.2 Referencing Parameter values

To reference these parameters or to access the value contained in the parameter in the
called form you prefix the name with “:PARAMETER” and a dot separator.

e.g.
If you have created a parameter with name ‘dno’ and want to assign its value to a variable
D2K For ms Builder

v_depno you have to wrote


V_depno := :PARAMETER.dno;

For e.g. to use the parameter Currec_attr to set the form parameter in a when-New-Form-
Instance trigger you would refer to :PARAMETER.Currec_attr.

Declare
V_Form_Id FormModule;
BEGIN
V_For,_Id := Find_Form (: System.Current_Form);
Set_Form_Property(V_Form_Id, Current_Record_Attribute,
: PARAMETER.CURREC_ATTR);
END;

11.6.3 Using parameter lists to pass values from one form to another

Parameter are passed to called forms by means of a parameter list. Parameter lists are
created programmatically and are used to hold parameter names and their values. They
are internal three column constructs that contain the parameter names, the type of
parameter and it’s value. Parameter names are called keys.

The parameters whose values are being passed must have been defined in the called form
at design time. That is, the called form must be expecting a value for each of the
parameters included in the parameter list it receives from the calling form. In short, create
the parameter list in the calling form and the parameters at design time in the called form.

Parameters are of two types TEXT_PARAMETER and DATA_PARAMETER.

TEXT_PARAMETER
When a parameter is defined of type TEXT_PARAMETER, then character values (string
of 255 values) can be passed to the other form or Oracle products.

DATA_PARAMETER
When you specify a parameter of type DATA_PARAMETER, you have to pass the name
of record group defined in the parent form. You can use data parameters to pass data
when you use run_product built-in to pass data to other product and not to pass data
within forms.

11.6.4 Creating Parameter_Lists

To create parameter list, use CREATE_PARAMETER_LIST built-in. It returns a unique


id of the list created. The id is of type paramlist. When a list is created, initially it
contains no parameters. Parameters have to be added to the list by using the
ADD_PARAMETER built-in. This is the way we create parameters at runtime and add it
to the parameter list.
D2K For ms Builder

11.7 Built-ins

CREATE_PARAMETER_LIST

Syntax
CREATE_PARAMETER_LIST (name);
Creates parameter list with the given name

ADD_PARAMETER
Syntax
ADD_PARAMETER(list key, parameter type, value);

List:
Specifies parameter list to which parameter is attached.

Key:
Name of the parameter.

Parameter type:
Either text or data type parameter.

value
actual value

GET_PARAMETER_LIST
Syntax
GET_PARAMETER_LIST(name);
Returns a parameter list ID when it finds a valid parameter list with the given name.

e.g.
To create a parameter list and pass it as a parameter to the called form by using
Open_form built-in.

Declare
P1_id paramlist;
Begin
/* ‘param is the name of the parameter list */
p1_id := get_parameter_list (‘param’);
/* If a list with name ‘param’ already exists the destroy the lsit */
if not id_null(p1_id) then
destroy_parameter_list(p1_id);
End If;
P1_id := Create_parameter_lst(‘param’);
D2K For ms Builder

/* Add a parameter of type TEXT_PARAMETER */

add_parameter(p1_id, ‘para’, TEXT_PARAMETER, ‘SMITH’);

/* Pass the parameter list to the called form */

open_form(‘form2’, ACTIVATE,NO_SESSION,p1_id);
END;

The keys in the parameter list should have same names as that of the parameters defined
in the called form.
D2K For ms Builder

12 Libraries
A library is collection of objects. These objects can be PL/SQL program units like
functions and procedures or Form objects like alerts, editors, push buttons etc. Based on
the type of objects stored in the library Form Builder provides us two types of Library
modules.

Ø PL/SQL Libraries
Ø Object Libraries

12.1 PL/SQL Libraries


A PL/SQL library is a collection of PL/SQL program units, including user-named
procedures, functions and packages. The program units here can be used in triggers and
procedures written in Form Builder if the library is attached to the form. Same library can
be attached to multiple forms and menus. On the other hand, a single form or menu can
have more than one library attached to it. Libraries are loaded into memory at the same
time as the module to which they are attached.

12.1.1 PL/SQL Library File Formats

There are three PL/SQL library file formats, .PLL, .PLX, and .PLD

.PLL : The library .PLL file contains both library source code and the compiled,
executable code. The >PLL file is created or updated when you save your library
module. When you save your library module, the changes are reflected in each
module to which the library is attached.

.PLX : The library .PLX file is a platform-specific executable that contains no source.
You can generate a .PLX file from the Designer or from the command line.

When you attach a library to a module in the Designer, you attach the .PLL
version of the library. At runtime, Form Builder looks for a .PLX file by that
name in the default a search path. If no .PPLX file is present, Form Builder looks
for the .PLL file by that name.

.PLD : The >PLD file is a text format file, and can be used for source-controlling you
library files.
D2K For ms Builder

12.1.2 Creating a PL/SQL Library

1. Select File -> New -> Library to open a new library module in the designer
OR
Select the Libraries node and then choose Navigator -> Create
2. To create a program unit, expand the desired library node, select the Program Units
node, and then choose Navigator -> Create
The New Program Unit dialog appears

Figure 12-1: New Program Unit Dialog

3. Specify the program unit Name and its Type (Procedure, Function, Package Spec, or
Package Body). Choose OK.
The PL/SQL Editor appears. Write PL/SQL c ode into it and compile it.
4. Save the library to file or database.

Once you create a library, you can attach it to any other form, menu, or library module.
Then, you can call library program units from triggers, menu item commands, and user-
named routines you write in the modules to which you have attached the library.
Libraries can also be attached to other libraries. When a library attaches another library,
program units in the first library can reference program units in the attached library.

12.1.3 Attaching a library

To attach a library to a any module

1. Open the module and select Attach library node.


D2K For ms Builder

2. Double Click on this node or select Navigator -> Create to get an Attach Library
dialog.
3. Enter the name of the library to be attached or search the name by clicking on FIND
4. Click on Attach button and the library gets attached to the current module. Once
library is attached, you can successfully compile form triggers and procedures that
reference the library program units.

Figure 12-2: Attach Library Dialog

12.1.4 Calling PL/SQL Library Program Units

To give a call to library program units from any other module:

1. Attach the required library


2. You can then call library program units from that module using the same syntax
you would use if the program units were defined locally.

When Form Builder encounters a call to a program unit, it first looks for the program unit
in the current module, then searches the attached libraries.

12.1.5 Editing or Viewing the contents of the PL/SQL Library

If you have attached a library to your module, you will not be able to view the code of the
program units it contains from the Attached Libraries node in the Navigator. To edit or
view library program units, you must open the library module itself.

When you edit a library, your modifications are not reflected in any modules that the
library is attached to, until you save your changes.

To modify a library that is already attached to a module:

1. In the Navigator, open the library module and then add, edit or remove program
units from the library as desired.
2. Save the library module
D2K For ms Builder

The changes are reflected in each module to which the library is attached.

12.1.6 Scope of Variables

Library modules being separate module are compiled independently of forms and menus.
As a result, you cannot refer directly to form bind variables (the values of form items,
system and global variables, and parameters) in a library program unit i.e. you cannot
refer directly to the following variables:

1. :block_name.item_name
2. :GLOBAL.variable_name
3. :SYSTEM.variable_name
4. :PARAMETER.parameter_name

Hence, we have to use the NAME_IN built-in to refer to the values of bind variables.
You can say Name_In(‘block_name.item_name’) to get the name of the item.

To set the values of bind variables we have to use the COPY built-in.

For example to set the value of item empno from EMP block to 7999 we can use Copy in
the following manner:
Copy(‘7999’, emp.empno’);

When COPY is used to set the value of a form item in a library routine, that item is
marked as CHANGED. This behavior can affect subsequent validation and comit
processing.

Whenever possible, you should write library program units that rely on IN and IN OUT
parameters for passing data between the form or menu module and the library. You can
also use functions with return values for this purpose. When you call a library procedure
that uses parameters, you can pass bind variable references as actual parameters, as
shown here:

My_library_procedure(:form_block.form_item,:System.Cursor_Block);

12.2 Object Libraries


Object libraries store form objects like blocks, items, alerts, editors etc. These objects can
be dragged into the library and reused into other modules. We can store standard objects
in the Object Libraries and use them through out the application to give it a uniform look
and feel.

The Object Library provides an easy method of reusing objects and enforcing standards.
With the help of Object Libraries we can make use of powerful, object-oriented features
D2K For ms Builder

to improve produc tivity through object reuse we can rapidly create applications by
dragging and dropping predefined objects to your form.

You can create template forms, reports, or charts for enforcing standards and rapidly
develop applications. Whenever a new document is created using a template, all the
objects in the template (e.g. standard toolbars, standard layout, and standard libraries etc.)
are automatically included.

12.2.1 File Formats

Library modules are stored in binary format. They can be saved to files or to the database,
and are portable across platforms. When you compile a binary module, Form Builder
creates a platform-specific runfile. You can also use the Forms Compiler to create a
human-readable text file that is portable across platforms. In case of Object Libraries we
have the following file formats:

OLB Object Library Module Binary


OLT Object Library Module Text

12.2.2 Adding Objects to Object Library

The Object Library consists of tabs. You can add objects to these tabs. You can arrange
the objects in such a wa y that similar types of objects exits on the same tab page. This
will clear after you understand how to create the Object Library,

To create a Object Library


In the Object Navigator highlight the Object Libraries node and click on the create ‘+’
button in the toolbar. You will find that a Object Library with Library Tabs node is
created.

To create Library Tabs


In the Object Navigator highlight the Library Tabs node and click on the create ‘+’ button
in the toolbar.

Displaying the Object Library


In the Object Navigator menu, choose Tools -> Object Library

To add Objects
Drag the object to be added and drop it into the desired tab page.
D2K For ms Builder

Figure 12-3: The Object Library

The above figure shows that an object named Comment_Editor has been added to the
Object Library. The Comment_Editor is a user defined editor and can be used in different
forms where it is required to attach such an editor to an item. Thus what we have done is
that we have created an object in the form module and then included it in the Object
Library by dragging it.

12.2.3 Subclassing an Object

To reuse the Objects in the Object Library, it will be required that the object created in
the Form module should simple inherit the properties from the parent objects. These
parent objects are nothing but the standard objects saved in the Object Library. Inheriting
the properties from the parent class essentially means that you have to subclass the object
created in the Form module. This subclassing can be done in different ways.

To include this object in any other Form module, first save the Library and then simply
drag the object from the Object Library and drop it under the relevant node. Forms
Builder will show you the Subclass-Copy-Cancel screen. You can subclass or copy the
object as desired.

One more method of subclassing (deriving) an object from the objects stored in Object
Library is that you can create the object and then double-click on the subclass
D2K For ms Builder

information property in Property Palette to see the Subclass information dialog. Select the
object included in the Object Library, in order to subclass your current object from the
already created object. Here the object that you have created in your Form module is the
derived class as you are deriving its properties from some other class. This other class or
the parent class is the standard object stored in the Object Library.

12.2.4 SmartClasses

Object Libraries feature Smart Classes are the objects that you define as being standard.
They can be used to convert objects to standard objects. In other words, we can say that
Object libraries can be used to specify the classes that are frequently used as the basis of
other objects in forms. If you mark an object in the library as standard class, whenever
developers create a new object of that type, they can quickly pick from a context-
sensitive list of standard classes know as Smart Classes.

12.2.5 Creating, applying and modifying SmartClasses

Ø Display the Object Library


Ø In the Object Library, click the desired object
Ø Choose Object -> SmartClass from the menu
D2K For ms Builder

Figure 12-4: The Object Menu

As seen from the figure 4, the object for which a smartclass is created is tick marked. To
add comment to the objects in the Library Tabs choose Object -> Edit Comment from the
menu. Type the desired text in the Comment dialog.

To create an object (in the Form module) based on this SmartClass you can drag the
object into the Form module under the desired node.

If you have to apply the SmartClass to an already existing object, then highlight the
object to be based on the SmartClass and right click to display the popup menu. Click on
the SmartClass option. This is shown in figure below. Whenever you apply a SmartClass
to an object, the object is automatically subclassed.
D2K For ms Builder

Figure 12-5: SmartClasses

In order to modify a smartclass object drag the object from Object Library to the form
module under the appropriate node, make changes to the object and shift + drag the
object back to the Object Library. The following Dialog box is displayed.

Figure 12-6: Modifying an object existing in the Object Library


D2K For ms Builder

Click on Yes to replace the existing object by the modified object. In order to reflect the
changes made to the parent SmartClass in every child instance of the SmartClass perform
the following steps:

Ø Include the standard object in the Object Library


Ø Create the child object in the Form module
Ø In the property palette of the child object, double click on the subclass
information property, so that the subclass information dialog box is displayed.
Select the Object Library name in the module field and the object from which you
have to inherit the properties into the Object Name field.

Figure 12-7: Subclass Information Dialog

Ø After subclassing from the parent object (the object included in the Object
Library), now if you modify the object as explained earlier then the links between
the parent and the child objects are maintained.

The Link is maintained between the parent and child object only if you have subclassed
the child object through the Subclass Information property in the pr operty palette.

12.3 SmartTriggers

SmartTriggers are the triggers that appear in the popup menu (displayed by RightClicking
on the object) of the object. Clicking on the SmartTriggers option in the popup menu
gives you a list of most frequently used triggers for that type of item. These are the
triggers that are the most probable triggers for the item types. Say for textitems, triggers
like When-Validate-Item, Pre-Text-Item, Post-Text-Item and When-New-Item-Instance
are the most probable triggers. If the item type is List Item then along with When-
Validate-Item and When-New-Item-Instance the When-List-Changed triggers appear in
the popup. Note that Form Builder does not generate any code for these triggers. You
have to add the code to these triggers in the PL/SQL editor.
D2K For ms Builder

13 Menus

13.1 Introduction
A menu is a hierarchical structure that provides a quick and convenient way to run the
Forms application. You can run your forms using Default menu or customized menu or
without using any menu.

13.2 Default Menu


A form can run with the default menu that is built into every form. A default menu is not
a separate menu module. It includes standard commands for navigation, editing, and
database interaction.

The Default menu is part of every form, and is used automatically if you do not specify
otherwise. In order to use the default menu for a particular form module, invoke the Form
Module property sheet. Type DEFAULT in the menu module property field. Choose OK
to accept the property palette. You cannot change the structure of the default menu.

13.3 Custom Menu


A Custom menu is a menu, which you can create on your own to have additional
functionality than that provided by the default menu. It is a separate menu that you define
in the Form Builder and then attach to the form. Custom menu can run in pull-down or
full screen style.

Menu module components


Components Description
Attached Libraries You can attach libraries to your menu module through this node and
make use of the program units in it.
Menus It lists the menus in the module like main menu, individual menus,
submenus and menu items.
Object Groups These are logical containers for set of Form objects
Parameters To set the initialization and execution variables in the menu
Property Classes It lists the property classes, which contain list of properties and
their settings
Visual attributes It lists visual attributes, which contain font, colour and pattern
properties for menu objects.
D2K For ms Builder

We will concentrate on the menu component of the menu module. Each menu module
contains one or more menus. Each menu contains one or more menu items.

A menu module includes following types of objects:


Ø The module itself
Ø The individual pulldown menus in the module hierarchy
Ø The menu items on each individual menu, and their associated commands
Ø Menu substitution parameters
Ø User-named routines and startup code

13.4 The Menu Editor


The Menu Editor is a tool that facilitates the development of menu for Form Builder
applications. By graphically displaying the menu while it is being designed, allowed
application developers to get a real picture of its behaviour at runtime.

Just as you work with form modules in the Navigator and the Layout Editor, you work
with menu modules in the Navigator and the Menu Editor. The Navigator and the Menu
Editor synchronize when you select a menu or menu item. For example, if your select an
item in the Menu Editor, that item is selected in the Navigator as well, even if it requires
expanding a node or a menu.

You can display multiple menu modules at the same time in separate Menu Editor
windows. With one Menu Editor window open, select another menu module in the
Navigator, then choose Tools -> Menu Editor. This graphical editor can be used to create
individual menus and add items to menus. The property sheet of the each item allows you
to define special type of menu items and assign commands to menu items.

Figure 13-1: The Menu Editor


D2K For ms Builder

13.4.1 Invoking Menu Editor

In order to access the menu editor, at least one menu module must be open in Object
Navigator.

13.5 Creating A Menu Module

While learning how to create a menu we will create the following menu. Your menu
hierarchy should be as shown:

Action Forms Edit Query

Clear All Master à Employee Cut Enter


Save Department Copy Execute
Exit Paste
Edit

13.5.1 Steps to create menu module

1. Choose File -> New -> Menu


OR
Select menus node and click on the Create icon. A menu Module is created with a default
name.
D2K For ms Builder

Figure 13-2: The Object Navigator

Name the menu appropriately.

2. Once you have opened a menu module you can create:

Ø A main menu (displayed as a horizontal menu bar)


Ø Individual menus consisting of menu items (displayed vertically)
Ø Submenus (displayed to the right of menu items)

13.5.2 Creating Menus and Menu Items

1. Create menu by selecting the menus node (the menu component within the menu
module). Oracle Forms create a menu named MAIN_MENU having a menu item
with name ITEM1 and <New Item> by de fault. To work in outline style use the
object navigator. To work in graphic style use the menu editor. We will be working in
the menu editor.
2. Type a menu label to replace the default label.
3. To add new items choose Menu -> Create Right or click Create Right icon. The Menu
Editor create a menu item <New Item> and selects it so you can edit the label.

Let us try to create the following menu


D2K For ms Builder

Figure 13-3: Menu Editor

Once the main menu is complete, you are ready to create the individual menus, which
means adding menu items to the menu. For each parent item on the main menu you can
create a list of related child menu items in the following manner.

Ø Select the menu item from the main menu.


Ø Choose Menu -> Create Down or click Create Down icon. The Menu Editor
creates a menu item <New Item> and selects it so you can edit the label.

Figure 13-4: Main Menu (Menu1)

Ø Your individual menu for example Action menu will look like this.
D2K For ms Builder

Figure 13-5: Action Menu

You will notice that when you add the first menu item, Oracle Forms places a shaded
rectangle or handle to the left of the first item, such as Action. The handle lets you move
all the items on the menu as a unit or display the Menu level properties in the Properties
window.

Menu items can call submenus, which are displayed to the right of the item.

To create a submenu:

Ø Select the parent item on the individual me nu.


Ø Choose Menu -> Create Right to add first item on a new submenu or click Create
Right icon. The Menu Editor creates a submenu item <New Item> and selects it
so that you can edit the label.
Ø Type to replace the default label.
Ø Choose Menu -> Create Down to add another item to the submenu
Ø Type to replace the default label.

Create a submenu for the menu item Master and add two items to this submenu. Name
these items as Employee and Department. We will be using these items to run our
Employee and Department master forms.

The steps in Detail are as follows:

Ø Click Create Down icon from the tool bar, to Create Item (Clear All) under the Action
menu.
Ø Click Create Down icon from the tool bar, to Create Item (Save) under the Action
menu
Ø Click Create Down icon from the tool bar, to Create Item (Exit) under the Action
menu.
D2K For ms Builder

Ø To create items under the Forms menu. Select Action by clicking on Action menu
Ø Now click Select Right Icon from the toolbar. <New_Item> is created type Forms
Ø Click Create Down icon from the toolba r to create Item (Master) under the Forms
Menu
Ø There is a sub menu (Employee & Department item) under the Master Item click
create right icon from the toolbar (make sure the currently selected menu is Master)
type Employee under the Master Menu
Ø With Employee menu item being the currently selected menu item click Create Down
icon on the toolbar type Department.
Ø Select the Forms menu, click Create Right icon on the toolbar a <New_Item> is
created type Edit.
Ø The Edit menu is created, create menu items for Edit menu Click Create Down icon
from the toolbar. In <New_Item> type Cut. Click Create Down icon from toolbar
Type Copy Click Create down icon type Paste
Ø Follow the same steps for the Query Menu too

Figure 13-6: The Complete Main Menu as seen in the Menu Editor
D2K For ms Builder

Figure 13-7: The Complete Main Menu as seen on the Object Navigator

Navigating and Selecting in menu Editor

If the object you want to navigate is visible, clicking on it moves the builder’s focus on
the object and selects it. To select a menu item click inside the rectangle that represents it.
You will notice that when you add the first menu item, Oracle Forms places a shaded
rectangle or handle to the left of the first item. The handle lets you move all the items on
the menu as a unit or display the Menu level properties in the Properties window.
D2K For ms Builder

To select a menu, click the menu handle to its left. E.g. when you Click the handle on the
left of the Clear_All item the Action_menu menu is selected in the object navigator.

Figure 13-8: Object Navigator and Menu Editor

13.6 Types of Menu Items

You can customize your menu using different item types. In addition to plain menu items
Forms has provided us with four types of special menu items Check, Radio, Separator
and Magic. The type determines how the item is displayed and whether the item can have
an associated command.

Plain Default. It is a standard text menu item


Check Indicates a Boolean menu item. It has two states Checked representing On
and Unchecked representing Off. Whenever the operator selects a Check
menu item Oracle Forms toggles the state of that item and executes the
command associated with that menu item, if there is one. These items are
displayed with a visual indicator (a tick mark) indicating their current state.
Radio Indicates a BOOLEAN menu item that is part of menu radio group. A group
contains one or more related group items. Enter a radio group name in the
Radio Group property field. One and only one Radio menu item in a group is
selected at any given time.
When the operator selects a Radio menu item, Oracle Forms toggles the
selection state of the item and executes its command, if there is one.
Separator It is a horizontal line, which visually separates related menu items from other
items on the same menu. A Separator menu item cannot be selected and
therefore it cannot have a command associated with it.
Magic These menu items pr ovide a quick way to include the standard functions
provided by usual graphical user interfaces. They are predefined menu items
lime Cut, Copy, Paste, Clear and Undo, About, Help, Quit and Window.
Magic menu items are automatically displayed in the style of the platform on
D2K For ms Builder

which the form is executed, in the position determined by the platform’s


conventions, with the appropriate accelerator key assigned wherever
required. Some of the menu items like Cut, Copy, Paste, Clear, Windows,
and Quit have built-in functionality supplied by Oracle Forms, while the
other magic menu items require that commands be associated with them.

13.7 Assigning Commands to Menu Items


You have to associate a command with a menu item. At runtime when that particular
menu item is clicked, the command is invoked.

To assign a command to a menu item, invoke the property palette for the menu item and
enter the command Type and the command text property.

Menu Item Command Types:

Command Type Description Command Text


Null The default command type Not applicable
specifies that the menu item does
not issue a command.
Menu Invokes a submenu The name of the sub-menu to be
called by this menu item.
PL/SQL Executes PL/SQL PL/SQL statements and built-ins

13.8 Using PL/SQL Code in Menu Modules:


Through the PL/SQL code, you can control and manipulate menus and menu items
programmatically at runtime. PL/SQL code can be used in:

Ø Menu items
Ø Subprograms (user-named routines)
Ø Start-up code

13.8.1 Menu Items

You can use PL/SQL code in menu items by defining the item command type as PL/SQL
and writing the code in command text. To assign a PL/SQL command to a menu item in
the Menu editor, select the menu item, set the Command type property to PL/SQL, enter
the code and choose compile.

PL/SQL menu items commands are similar to form triggers. In addition to standard
application functions such as navigation, validation and database interaction, you can use
PL/SQL commands to do the following actions.
D2K For ms Builder

Action Comments
Invoke a form A menu item with PL/SQL command tyoe can
invoke a new form in the same session by calling
the OPEN_FORM, CALL_FORM or the
NEW_FORM built-in procedures
Execute operating system commands To execute operating system commands from a
PL/SQL item call the HOST built-in. parameters
to the built -in specify the operating system
command to execute.
Invoke another Oracle Tool You can all the RUN_PRODUCT built -in to
invoke different Oracle Products like Oracle
Forms Runform, Oracle Reports or Oracle
Graphics.
Call the DO_KEY built -in To execute the key trigger that corresponds to
the specified built-in routine.
Call EXECUTE_TRIGGER built-in Unlike PL/SQL menu items, a user-defined
trigger defined in the form module can directly
refer to the values of the form items. If you want
to write a user-named routine or anonymous
block that uses direct references, you can place it
in a user-named trigger and then call that trigger
from a PL/SQL menu item command with this
built-in.

13.8.2 Pop-Up Menus

Pop-Up Menu is a floating menu that pops up when you click the right mouse button on a
canvas or item. They let the user quickly fire off some action relevant to the location of
the mouse in the application.

To Create A Pop-Up Menu:

1. In the Object Navigator Select the Popup Menus node.


2. Click the Create tool from the t ool Palette.
3. A PopUp menu with default name gets created
D2K For ms Builder

Figure 13-9: Popup Menus

Right Click on the Popup Menu Select the Menu Editor. In the Menu Editor Create the
following menu.

Figure 13-10: Menu Editor

To make this popup menu available when the user right clicks either in the canvas or on
an item:
Ø Select the property palette of Canvas
Ø From the property Popup Menu pull-down select the desired popup name.
Ø In the RunForm Right Click anywhere in the Canvas to display the popup menu.
D2K For ms Builder

13.9 Toolbars
Toolbars is a standard feature in GUI applications. They group together iconic buttons
and help users access functionality that is used frequently.

Developers must provide icons to associate with each menu item that appears in a Menu
Bar.

To Create a tool Bar

Figure 13-11: The Toolbar


D2K For ms Builder

Figure 13-12: Menu Property Palette

In the Menu Property Palette, the Property Visible in Horizontal Menu Tool Bar specifies
whether the menu item should appear (represented by an icon) on the horizontal or
vertical menu toolbar (or both) of a form. The Property Icon in Menu specifies whether
the Icon should appear in the pulldown menu item.

13.9.1 SubPrograms

You can create user-named subprograms (user-named routines) in a menu module by


writing them in the PL/SQL editor. Just as you would in a form module. A user-named
subprogram can be called from any menu item in the same module that is defined as a
PL/SQL command type.
D2K For ms Builder

13.9.2 Startup Code

Figure 13-13: Menu as seen at runtime

Menu startup code executes when a menu is loaded into the memory at form startup or as
a result of call to the CALL_FORM, NEW_FORM, or REPLACE_MENU built-in
procedures. Startup code can be used to perform the following tasks.

Ø Initialize substitution parameters and global variables


Ø Programmatically set the initial display state of menu items: for example to enable
or disable a menu item or to select a check or radio menu item.
Ø Programmatically set the initial Display State of check and radiomenu items

To write the startup code for menu, select the desired menu module in the Menu Editor or
Object Navigator Invoke the properties window and fill in the Startup Code field or
double-click the Startup Code field to invoke the PL/SQL Editor. Writing startup code is
similar to writing a trigger, and startup code can include anonymous blocks and calls to
built-in subprograms.

To write a startup code, Select Menu Module to invoke the property palette, choose
Startup Code to invoke the PL/SQL editor. Enter and compile the PL/SQL code to be
executed at startup of menu.

e.g.
To disable the menu when the form starts; the menu should be enabled only after
confirming if the user is allowed access to the menu.

Syntax
Ø GET_MENU_ITEM_PROPERTY(menu_name.menuitem_name VARCHAR2
property NUMBER);
Ø SET_MENU_ITEM_PROPERTY(menu_name.menuitem_ name VARCHAR2
D2K For ms Builder

property NUMBER, value NUMBER);

Write the following in the menu Startup Code:

Set_Menu_Item_Property(“ACTION_MENU.SAVE’,ENABLED,
PROPERTY_FALSE):

To Enable this item after checking the password, assume a form which accepts username
and password. If password is correct then the Save option should be available to the user.
To do this write the following code in the appropriate trigger:
Set_Menu_Item_Property(“ACTION_MENU.SAVE’,ENABLED,
PROPERTY_TRUE):

13.10 Referencing Objects in PL/SQL


Menus are reusable modules that are generated separately from forms. Thus references to
form objects in menu item PL/SQL commands must be coded differently than references
to form objects in menu item PL/SQL commands must be coded differently than
references to the same objects in triggers or user-named routines within a form. You
cannot reference the value of an Oracle Forms object directly; instead, use the NAME_IN
built-in function to determine the Objects current value.

e.g.
Code the following
If Name_In (‘Emp.Ename’) = ‘Adams’ Then
Statements…
Else
Statements…
End if;

Similarly use Copy built-in to assign a value:


Copy (‘Smith’ , ‘Emp.Ename’)
D2K For ms Builder

13.11 Attaching a Menu Module to a Form

Figure 13-14: Menu module Property Palette

In the Menu Module property palette, set the Main Menu property to indicate the name of
the main menu. This tells Form Builder, which individual menu is the main menu in the
module Operators cannot navigate above the level of the main menu. In the Main field of
Menu property sheet enter the name of the main menu in the module. The default for this
property is the name of the module itself, however, the main menu is not required to have
the same name as the module.

Before you can run a custom menu with a form you must:

Ø Generate the menu module to create a runtime menu file. With the Menu the
current node Click File -> Administration -> Compile File or use shortcut Ctrl + T
Ø Attach the menu to a form
D2K For ms Builder

In the form Property Palette

Figure 13-15: Form module Property Palette

In the Form Property Palette the Menu Source property when attaching a menu to a form,
there are two ways to specify the location of the runtime menu file: direct reference or
database lookup. To refer to the .MMX file directly

1. Open the Property palette of the Form module to which the menu is to be
attached.
2. In the menu name property, simply enter the path and filename of the menu
runfile.

At form startup, Oracle Forms automatically loads the specified .MMX file. If the menu
design module is stored in the database, and if the form will be connected to that database
at runtime, you can attach a menu to a form through database lookup.

1. Set the Menu FileName and Menu Directory properties to specify the location of
D2K For ms Builder

the menu .MMX runfile.


2. Save the menu design to the database
3. Attach the menu to the form by entering the name of the database menu module in
the Module Name form property

Condition / Property Direct Reference Database Lookup


Form Module “Module Name of .MMX runfile Name of the MMB menu design
Name” Property module in database
Menu Module N/A Path/filename of .MMX file in
“Directory / File” file system
Database Connection Not required Required at form startup
Location of Menu MMB N/A Must be stored in database
at load Time

13.12 Adding Features to a Basic Menu

You can customize a menu by adding special features and functionality.

Ø Create check, radio and separator menu items


Ø Define mnemonic keys and keyboard accelerators
Ø Display icons in menu items
Ø Specify menu titles
Ø Define a background menu
Ø Create tear-off menus
Ø Display hint text for menu items

13.13 Define Mnemonic keys and Keyboard Accelerators

A mnemonic character is a special character in menu item name that operators can use
with a function key to select the menu item, without having to use the mouse. To define
the mnemonic character for a menu item, enter the ampersand (&) in from of the
character in the main menu item name.

A keyboard accelerator is a function key or key sequence that operator can press to
execute the menu item command. Oracle Forms provides five logical accelerator keys
that you can assign to menu items, named [ACCELERATOR1] through
[ACCELERATOR5]. To assign accelerator keys to a menu item, select menu item in the
menu editor, type the logical accelerator key you want to assign to the item in the
Accelerator property field. Associate logical key to a physical device key or key
sequence.
D2K For ms Builder

13.14 Creating a Tear-off Menu


A tear-off is a submenu that operators can drag away from the menu bar and reposition
elsewhere on the screen. This functionality can be enabled for any submenu. To make a
menu tear-off menu, select a desired menu in the Menu editor, display the menu property
sheet and set the Tear-Off property On.
D2K For ms Builder

14 Product Integration

14.1 Introduction

Product integration as the name suggests explains how to integrate different Oracle
Products namely Form Builder 5.0, Report Builder 3.0 and Graphics Builder 3.0.
Integrated applications improve end-user productivity by providing combined access to
multiple special-purpose tools.

The primary way to integrate Form Builder with other tools is to write an appropriate
form trigger to invoke another tool in response to some event. When Form Builder
invokes another product, it can also pass parameters to the other product.

14.2 Run_Product Built-in

Run_Product is a built-in that helps you to invoke other products from Form Builder with
the RUN_PRODUCT built-in procedure. By default, when you invoke Report Builder or
Graphics Builder with RUN_PRODUCT, the called product logs on to ORACLE using
the current form operator’s USERID. The syntax for RUN_PRODUCT is shown here:

Syntax
RUN_PRODUCT(product, document, com-mode, exec-mode, location, list, display);

Form Builder uses the parameters you pass to RUN_PRODUCT to construct a valid
command line invocation of the called product. RUN_PRODUCT takes the following
parameters:

Product : A numeric constant that specifies the Oracle tool to be invoked: FORMS,
REPORTS, GRAPHICS, or BOOK.

Document : Specifies the document or module to be opened by the called product.

Com-mode : Specifies the communication mode to be used when running the called
product. Valid numeric constants for this parameter are SYNCHRONOUS
and ASYNCHRONOUS.
SYNCHRONOUS
Specifies that control returns to Form Builder only after the called product
has been exited. The operator cannot work in the form while the called
product is running. Synchr onous is required when passing a record group
to a called product as a DATA_PARAMETER; for example, when
invoking Graphics Builder to return an Graphics Builder display that will
D2K For ms Builder

appear in a form chart item. Graphics to return an Graphics Builder


display that will appear in a form.
ASYNCHRONOUS
Specifies that control returns to the calling application immediately, even
if the called application has not completed its display. Do not use
ASYNCHRONOUS when passing a record group to a called product as a
DATA_PARAMETER; for example, when invoking Oracle chart item.
Exec-mode : Specifies the execution mode to be used when running the called
product, either BATCH or RUNTIME. When you run Report Builder and
Graphics Builder, execmode can be either BATCH or RUNTIME. When
you run Form Builder, always set execmode to RUNTIME.

Location : Specifies the location of the document or module you want the called
product to execute, either the file system or the database.

List : Specifies the name or ID of a parameter list to be passed to the called


product.

Display : Specifies the name of the Form Builder chart item that will contain the
display generated by Graphics Builder.

Example 1
Say you have to display a report that displays customer-wise orders. To run this report
through your menu write the following code in the menu item code.

Run_Product ( ‘REPORTS’, ‘ORD_BIND’, SYNCHRONOUS, BATCH,


FILESYSTEM, NULL, NULL)

Where ‘ORD_BIND’ is the name of the report.

Example 2

Let us create a form and use it to run a report as well as graphics. The report shows
region wise sales for the given month. The graphical display shows the same in the
graphical manner. (You will be creating this report and the graphical display in due
course. In this example we will see how to integrate these three products)

1. Create a form that has a control block and a control field.


2. The control field has item type list item. The list should display the full names of
the months (January, February…) where as the value should be only the first three
characters of the corresponding month (JAN. FEB…).
3. The form should have two push buttons labeled ‘Report’ and ‘Graph’. When
‘Report’ is clicked the report for regionwise monthly sale should be displayed.
Similarly when ‘Graph’ is clicked regionwise monthly sale should be displayed in
graphical manner.
4. Write the following code in the When-button-Pressed trigger for ‘Report’
D2K For ms Builder

declare
p1_id paramlist;
Begin
PL_ID := GET_PARAMETER_LIST(‘param’);
If not id_null (p1_id) then
Destroy_parameter_list (p1_id);
End if;
P1_id := create_parameter_list(‘param’);
Add_parameter(p1_id, ‘mon’, text_parameter, :ctl.month);
Run_product (REPORTS, ‘reg_sales’, ASYNCHRONOUS, RNTIME,
FILESYSTEM, PL_ID, NULL);
END;

5. Write the following code in the When-button-pressed trigger for ‘Graph’

declare
p1_id paramlist;
Begin
PL_ID := GET_PARAMETER_LIST(‘plist’);
If not id_null (p1_id) then
Destroy_parameter_list (p1_id);
End if;
P1_id := create_parameter_list(‘plist’);
Add_parameter(p1_id, ‘mon’, text_parameter, :ctl.month);
Run_product (GRAPHICS, ‘reg_sales’, ASYNCHRONOUS, RNTIME,
FILESYSTEM, PL_ID, NULL);
END;

6. To execute this form without errors, remember to create parameters in the report
and graph with name as ‘Mon’ of type character.
7. The Query for the report and graph should be as follows:

Select Region, Sum(Total) From Ord, Customer Where To_Char (Orderdate, ‘Mon’) =
:Mon Group by Region

14.3 Using Integrated Wizards

14.3.1 Reports Wizard

You can use Reports wizard and chart Wizard from within Form Builder. To work in
Reports Wizard highlight the Reports node in the Object Navigator and click on the
Create ‘+’ icon in the toolbar. The following New Report dialog is displayed.
D2K For ms Builder

Figure 14-1: New Report Dialog

Thus you can enter the name of an existing report or specify the name of a new report
file. In case you want to create a new report object to be based on the block in you tick
the Base Report on Block checkbox. Click on OK button. Forms Builder takes you to
Report Builder Report Wizard. In case your report is not based on any block, enter the
query in the Data page of Report Wizard. Once you are inside the reports Builder you
can view the report as desired. Thus you can create a report object via Forms.

You can open the Property Palette of the report object and set the execution mode and
communication mode properties under the Dev/2000 Integration node. You can run a
report using the Run_Report_Object built-in subprogram. This built-in returns a varchar2
value.

14.3.2 Chart Wizard

Chart Wizard is available in the Layout editor. When you work in the Chart Wizard it
creates a chart and the Chart item in the specified block.

Figure 14-2: Layout Editor Toolbar

In the Property Palette of the Chart item you will find that there is a new node Dev/2000
Integration node. With the help of properties under this node you can specify whether
you want to run the ogd file in Batch/Runtime execution mode. Synchronous /
Asynchronous communication mode. These are the same as explained earlier. You can
also specify the data source or the block name, the data from which the chart will be
drawn. The Property Palette for the Chart item is as shown.
D2K For ms Builder

Figure 14-3: Chart Item Property Palette


D2K For ms Builder

15 Implementing ActiveX Control

15.1 Object Embedding and Automation


An important feature of Microsoft Windows Operating System is its ability to share
information. Prior to this, in order to share information of one application with another
you had to save the data to a file then import the data into the target application. This
technique was time consuming and not efficient. Microsoft then introduced DDE (a
means of communication between MS Windows application). This acts as a link for
exchange of data between connected applications. Then came OLE, OLE gives your
application the power to directly use and manipulate another windows application data
(in it’s own native format).

15.1.1 ActiveX
ActiveX is composed of a group of technologies or components to develop and
implement applications for Internet. An ActiveX control is not a type of VBX. Vbx
controls function strictly under 16-bit applications, they do not function under 32-bit
environment. It is recommended to use ActiveX controls and OLE Servers developed and
distributed by third parties.

15.1.2 ActiveX support in Form Builder

Form Builder provides support for ActiveX controls. ActiveX controls are reusable
components that can be embedded in your Form Builder Application. Form Builder acts
as an ActiveX control container. Each ActiveX control exposes a set of properties,
methods, and events. Properties define the ActiveX control’s physical and logical
attributes, methods define actions that the ActiveX control can perform, and events
denote some change in status in the ActiveX control. A client application manipulates an
ActiveX control by writing values to and obtaining values from its properties, invoking
methods that are used to get and set properties, and intercepting and acting on events.
OLE is not an application development environment. It is an architecture that integrates
software services.

OLE means Object Linking and Embedding and it refers to the technology of working
with compound documents. Compound documents link or embed one or more documents
together solving the problem of integrating different object types in a single document.
For instance, a compound document can be a Form module document that contains
objects from other applications such as word processor documents or spreadsheet
documents.
D2K For ms Builder

15.1.3 OLE Server

Applications that support OLE can be OLE Servers, OLE containers or both. An OLE
Server application creates OLE objects that are embedded or linked in the OLE
Containers. Examples of OLE Servers are MS-Word, MS-Excel. OLE Container
applications do not create documents for linking or embedding. For example Form
Builder is a OLE Container application. The OLE Container control allows you to add
insertable objects and call OLE Server in your Forms application. ActiveX controls
originally known as OLE controls or OCX’s make use of both ActiveX and OLE
technology. Extending the compound document solution to extend scope of sharing
services, the Component Object Model (COM) was introduced as OLLE2. ActiveX
includes the OLE implementation of COM and improves on it by extending its
capabilities to take advantage of Internet. This is something, which OLE did not have.
COM is a Microsoft model for building objects. It is a general architecture that lays the
foundation on which OLE version 2.0 is based. It establishes a common model for
interaction among software. Therefore Com can be implemented with any software.

Word processor documents, spreadsheet documents, know controls and video clips are
examples of component objects that can enhance the capabilities of your form. Instead of
recreating functionality that already exists, you can access these capabilities by exploiting
the ActiveX and OLE support in Form Builder. Component objects provide speciality
services not available in Form Builder, thereby enhancing the client application.

15.1.4 To add an ActiveX control to your application

Steps:

1. Create an ActiveX Control container


To create an ActiveX Control container
Ø In the Object Navigator expand the desired block node to display its subnodes
Ø Click the Items node
2. Click the Create button in the toolbar

ActiveX controls should only be added to single record blocks


Form Builder automatically initializes the ActiveX control when it is in a single-record
block. When you add an ActiveX control to a multi-record block, only the first instance
of the ActiveX control is initialized at start-up, the other instances remain uninitialized
until you navigate to that instance. Uninitialized controls appear blank, giving the
impression that there is no control available for those item instances

To create a single-record bloc, set the Records Displayed block property to 1, or set the
Number of Items Displayed property (for the ActiveX control container) to 1.

3. Double-click the object icon nect to the newly created item to display the Property
D2K For ms Builder

Palette.
4. Under the General node, set the Item Type property to ActiveX Control.
5. Under the Physical node, set the Canvas property to the name of the desired
canvas.
To display an item at runtime, you must assign it to a canvas.
6. Insert an ActiveX control
For ActiveX controls that interact directly with the data from a record, it is best to
insert ActiveX controls in a single-record blocks.

15.1.5 To insert an ActiveX control in a form

Steps:

1. In the La yout Editor, select the ActiveX control containers then click the right
mouse button to display the popup menu.
2. Choose Insert Object to display the Insert Object dialog.
3. Choose the desired control, then click OK.
4. In the Layout Editor double -click the ActiveX control container to display the
Property Palette
5. Under the Functional node:
Ø Set the OLE Class property each OLE Class contains a number of
controls.
Ø Set the desired control and container properties

15.1.6 Import the desired ActiveX control methods and events

To import ActiveX Control methods and events

1. Choose Program -> OLE Importer Menu Item to display the OLE Importer
dialog.
2. Select the desired OLE Class, then select the desired OLE methods and events.
3. Click OK
4. Form Builder displays the imported methods under the Program Units node in the
Object Navigator. You can access these OLE methods from your application by
using the STANDARD and OLE2 built-in packages.

Write the appropriate PL/SQL code to interact with the ActiveX control

Ø Call property accessors


Ø Invoke methods
Ø Respond to events
D2K For ms Builder

To invoke ActiveX control methods


You can access methods exposed by an ActiveX control with the program units generated
from the OLE Importer. Call any of the methods in any of the packages available under
the Program U nits node.

15.2 Inserting an ActiveX control in a form module


Calendar Control

The Calendar control displays a monthly calendar that you can insert in a form. Control
file Name is <SCAL.ocx.

The Calendar control supports properties that you can use to set and retrieve the date and
to control the appearance of the calendar. It supports methods that you can use to set the
day, month, and year, to show an about box, and to refresh the calendar. It also supports
events that notify your application when the user has moved to a new date on the
calendar, when the user has clicked or double-clicked on a date, and when the user has
pressed a key.

Sample Output (1)

At runtime when you execute the query, at that time data will be fetched and when you
click on the ‘…’ button the calendar will be displayed.
D2K For ms Builder

Figure 15-1: Sample Output(1)

User can select any date along with the month and year. User can place the selected date
in the ‘Hiredate’ field.
D2K For ms Builder

Figure 15-2: Sample output(2)

Steps
1. Create the new form.
2. Create the ‘EMP’ block.
3. Keep the layout style as ‘Form’
4. Select Empno, Ename, Job and Hiredate columns from the EMP table.
5. Change the name for the EMP canvas to EMP_CAN.
6. Create a push button named as ‘…’ and set its general properties
D2K For ms Builder

Figure 15-3: Emp Block

7. Write the ‘When-Button-Pressed’ trigger on it as shown below.

Figure 15-4: PL/SQL Editor

8. Create a new block named as ‘CTL’.


9. Make its Base-table property as ‘NO’.
10. Create the new canvas named as ‘CTL_CAN’. This canvas should be of type
‘STACKED’
11. Set its other properties as shown below
D2K For ms Builder

Figure 15-5 Property Palette of the Stacked Canvas

12. Place the CTL block on the ‘CTL_CAN’ and EMP block on EMP_CAN
13. Keep the CTL_CAN canvas active to place OCX control.
14. Click on the ‘OCX’ tool and draw a rectangular box.
15. Click the right mouse button to display the popup menu
D2K For ms Builder

Figure 15-6: Popup Menu

16. Select the ‘Insert Object’ option from the menu. It displays the insert object dialog
box.

Figure 15-7: Insert Object Box

17. Select the ‘Calendar control’ from the list.


18. Click on the ‘OK’ button
19. The calendar control gets placed in the ‘OCX’ item.
20. Open the property palette of it, and deselect the ‘Database Item’ property.
21. Create a push button and pace it below the ActiveX control.
22. Open its property palette and name the push button as ‘Select Date’.

Import the desired ActiveX control methods and events

23. To import the methods and events of the Calendar control, select the Program -> OLE
importer from the layout editor window’s menu.
D2K For ms Builder

Figure 15-8: Program Menu

24. Form Builder shows the OLE libraries interfaces along with the classes and events
and methods as shown below.

Figure 15-9: OLE Library interfaces

25. Select the ‘Mscal.calendar/7’ OLE class and select its events and methods, which will
be seen in the methods and events boxes.

The moment you select the methods and events, in the object navigator all the related
program units get created.
D2K For ms Builder

26. Go to the Object Navigator and expand your ‘+ Program Unit’ node. Check out the
packages and it’s related procedures and functions. In this form we will call those
readymade procedures and functions through the ‘Select Date’ push button.
27. Go to the ‘CTL_CAN’ canvas and select the ‘Select Date’ button and write when-
button-pressed triggrer as shown below:

Figure 15-10: PL/SQL Editor

In this code we are using the mscal_icalendar.day, mscal_icalendar.month, and


mscal_icalendar.year functions which will return the number datatype.

Ø FUNCTION Day (interface OleObj) RETURN NUMBER;


Ø FUNCTION Month (interface OleObj) RETURN NUMBER;
Ø FUNCTION Year (interface OleObj) RETURN NUMBER;

Example 1
/*Getting an ActiveX control property using accessor*/

tblname varchar2;
tblname := table_pkg.TableName(:item(‘Oblk.Oitm’) .interface);

For e.g.
DATE_DAY:= mscal_icalendar.day(:item ‘ctl.acti’).interface);

Mscal_icalendar is the name of the program unit created from the OLE Importer.
DATE_DAY is the name of the property accessor.
CTL is the name of the block and acti is the name of the item
D2K For ms Builder

Example 2

/*Setting an ActiveX control property using bind variable syntax*/

:item(ActXitem’).OCX.Spindial.spindialctrl.1.Needleposition :=
:item(ActXitem’).OCX.Spindial.spindialctrl.1.Needleposition + 1;

ActXItem is the name of the item, Spindial.spindialctrl.1 is the name of the ActiveX
control server, and Needleposition is the name of the property.

The following code also works if your system.cursor_item is an ActiveX control:

:form.cursor_item.OCX.spindial.spindialctrl.1.Need1position :=
:form.cursor_item.OCX.spindial.spindialctrl.1.Need1position + 1;

28. Wite the ‘When-New-Form-Instance’ trigger to hide the CTL_CAN


Hide_view (‘CTL_CAN’);
29. Compile the code.
30. Save the form and Run the form.

15.3 About OLE activation styles

You can activate an OLE object from a Form Builder OLE Container with in-place
activation or external activation. Activating an OLE object allows you to have access to
features from the OLE Server application that originated the OLE object. In-place
activation and external activation are possible only if the OLE Server application that
originated the OLE object is accessible by your computer. Both in-place activation and
external activation also depend on the OLE activation property settings of the OLE
Container. The OLE activation property settings are specified in Form Builder. If the
OLE Server application is accessible, the activation property settings of the OLE
Container determine whether in-place activation or external activation occurs when an
embedded OLE object is activated. Linked objects can only be activated with external
activation; in-place activation does not apply to linked objects, even if the in -place
activation property is set to yes. Activation of an OLE object is possible in Form Builder
and during Forms Runtime.

In-place Activation
In-place activation occurs when an OLE Container and its embedded object remain in
place when activated, Form Builder remains surrounding the OLE Container. In-place
activation is available for embedded objects, but it is not available for linked objects.

External Activation
External activation occurs when an OLE object appears in a separate window that is
opened by an object’s originating OLE Server application. Because an OLE Server
D2K For ms Builder

application starts up with its own windows, Form Builder menu options and toolbars
remain intact during external activation. External activation is available for both
embedded and linked objects. When a OLE object is activated, the object’s originating
OLE Server application is launched, and the OLE object appears in a separate OLE
Server application window. The separate window has the menu options and toolbars of
the OLE Server application. When the contents of a linked source file is modified with
external activation, a linked object can be updated manually or automatically. Manual
updates require an explicit instruction for an object to reflect changes from a linked
source file. Automatic updates occur as soon as you modify a linked source file.

15.4 The registration database


OLE Server applications can create many object classes. The object classes that an OLE
Server can create are installed in a registration database. The registration database stores
a set of classes that categorize OLE objects. The information in the registration database
determines the object classes that are available for embedding and linking in OLE
Containers. OLE Server applications export a set of classes that become members of the
registration database. Each computer has a single registration database. If the registration
database does not already exist when an OLE Server application is installed, one is
created. A single OLE Server application can add many OLE classes to the registration
database. The process of adding classes to the registration database is transparent and
occurs during the installation of an OLE Server application. For instance, when Microsoft
Excel is installed, several classes are added to the registration database; some of the
classes that are installed in the registration database; some of the classes that are installed
in the registration database include Excel Application Excel Application 5, Excel Chart,
Excel Sheet, Excel Macrosheet and Excel Worksheet.

About when to embed or link OLE objects


Whether an OLE object is embedded or linked depends how often an OLE object is
updated, how an OLE is shared, how the source document is accessed, and if there are
storage constraints.

You should use object embedding when


The object that you are embedding does not have to be the most current version of data
because updating is performed from within a form module instead of a standalone
document. The object does not need to be included in more than one document, so that
changes are only necessary in the object embedded in the form module and nowhere else.
The source document cannot be accessed if the object is lined. In this case, only a single
form module needs to be maintained and not a form module in addition to the source
document. The form module size is not a concern, because with embedding the size of
the form module increases by approximately the size of the embedded object.

You should use object linking when


The object that you are linking has to be the most current version of data because
updating is performed from outside a form module on a standalone document.
D2K For ms Builder

The object that needs to be included in more than one document, so that changes affect
multiple form modules and other documents. The source document can always be
accessed if the object is lined. The form module size is a concern: Linking, unlike
embedding, does not increase the size of the form module by the size of the object.
D2K For ms Builder

Table of Figures

Figure 1-1: The Object Navigator (Forms)........................................................................11


Figure 2-1: Welcome Screen.............................................................................................17
Figure 2-2: Connect Dialog Box........................................................................................18
Figure 2-3: Connection Request ........................................................................................18
Figure 2-4: Object Navigator .............................................................................................19
Figure 2-5: Editor ..............................................................................................................21
Figure 2-6: List of Values ..................................................................................................21
Figure 2-7: Property Palette...............................................................................................24
Figure 2-8: Layout Editor ..................................................................................................26
Figure 2-9: Tool Palette .....................................................................................................26
Figure 2-10: PL/SQL Editor ..............................................................................................28
Figure 3-1: Welcome Screen – Form Builder....................................................................36
Figure 3-2: New Data Block..............................................................................................36
Figure 3-3: Data Block Wizard : Welcome Page ..............................................................37
Figure 3-4: Data Block Wizard – Type Page .....................................................................38
Figure 3-5: Data Block Wizard – Table Page ....................................................................38
Figure 3-6: Tables Dialog ..................................................................................................39
Figure 3-7: Data Block wizard – Finish Page ....................................................................41
Figure 3-8: Layout Wizard : Canvas Page .........................................................................42
Figure 3-9: Layout Wizard – Data Block Page .................................................................43
Figure 3-10: Layout Wizard – Items Page .........................................................................44
Figure 3-11: Layout Wizard – Style Page .........................................................................45
Figure 3-12: Layout Wizard : Rows Page .........................................................................46
Figure 3-13: Data Block Wizard – Type Page ...................................................................48
Figure 3-14: DataBlock wizard – Query Page ...................................................................49
Figure 3-15: DataBlock Wizard Insert Page......................................................................50
Figure 3-16: DataBlock Wizard – Update Page ................................................................51
Figure 3-17: DataBlock wizard – Delete Page ..................................................................52
Figure 3-18: DataBlock wizard – Lock Page ....................................................................53
Figure 3-19: Radio Group and Radio Buttons in Object Navigator ..................................58
Figure 3-20: List Items Elements ......................................................................................65
Figure 3-21: Import graphic object ....................................................................................67
Figure 4-1: Master-Detail Page .........................................................................................73
Figure 4-2: Data Blocks List ..............................................................................................73
Figure 4-3: The Relation Object ........................................................................................74
Figure 4-4: New Relation Dialog ......................................................................................75
Figure 5-1: Trigger Names LOV.......................................................................................83
Figure 5-2: PL/SQL Editor ................................................................................................83
Figure 6-1: Property Palette (Property Class)..................................................................103
Figure 6-2: Subclass Information Dialog ........................................................................104
Figure 6-3: Setting visual attributes in Property Palette ..................................................107
Figure 7-1: LOV (Runtime) (Selection of Manager).......................................................115
Figure 7-2: New LOV Dialog ..........................................................................................116
D2K For ms Builder

Figure 7-3: LOV Column Mapping .................................................................................117


Figure 7-4: Displaying LOV at Runtime .........................................................................118
Figure 7-5: Form Alert (Connection Request).................................................................121
Figure 7-6: Save Alert .....................................................................................................122
Figure 8-1: New Record Group Dialog ...........................................................................125
Figure 8-2: Column specifications ...................................................................................126
Figure 8-3: Property Palette (Record Group) ..................................................................129
Figure 9-1: Tab Canvas placed on Content Canvas.........................................................133
Figure 9-2: Canvas Property Palette ................................................................................134
Figure 9-3: Canvas & it’s View .......................................................................................135
Figure 9-4: Stack Canvas on Content Canvas .................................................................136
Figure 9-5: Placing Stack/Tab Canvas on Content Canvas .............................................137
Figure 9-6: Dept Block on Content Canvas.....................................................................138
Figure 9-7: Canvas, View & Frame .................................................................................138
Figure 10-1: Object Group...............................................................................................141
Figure 10-2: Subclass/Copy Dialog.................................................................................142
Figure 10-3: Subclassed Objects in Object Navigator.....................................................143
Figure 11-1: Parameter Property Palette..........................................................................153
Figure 12-1: New Program Unit Dialog ..........................................................................158
Figure 12-2: Attach Library Dialog .................................................................................159
Figure 12-3: The Object Library......................................................................................162
Figure 12-4: The Object Menu ........................................................................................164
Figure 12-5: SmartClasses ...............................................................................................165
Figure 12-6: Modifying an object existing in the Object Library...................................165
Figure 12-7: Subclass Information Dialog ......................................................................166
Figure 13-1: The Menu Editor .........................................................................................168
Figure 13-2: The Object Navigator ..................................................................................170
Figure 13-3: Menu Editor ................................................................................................171
Figure 13-4: Main Menu (Menu1) ...................................................................................171
Figure 13-5: Action Menu ...............................................................................................172
Figure 13-6: The Complete Main Menu as seen in the Menu Editor ..............................173
Figure 13-7: The Complete Main Menu as seen on the Object Navigator ......................174
Figure 13-8: Object Navigator and Menu Editor.............................................................175
Figure 13-9: Popup Menus ..............................................................................................178
Figure 13-10: Menu Editor ..............................................................................................178
Figure 13-11: The Toolbar...............................................................................................179
Figure 13-12: Menu Property Palette ..............................................................................180
Figure 13-13: Menu as seen at runtime ...........................................................................181
Figure 13-14: Menu module Property Palette .................................................................183
Figure 13-15: Form module Property Palette ..................................................................184
Figure 14-1: New Report Dialog .....................................................................................190
Figure 14-2: Layout Editor Toolbar ................................................................................190
Figure 14-3: Chart Item Property Palette.........................................................................191
Figure 15-1: Sample Output(1)........................................................................................196
Figure 15-2: Sample output(2) .........................................................................................197
Figure 15-3: Emp Block ..................................................................................................198
D2K For ms Builder

Figure 15-4: PL/SQL Editor ............................................................................................198


Figure 15-5 Property Palette of the Stacked Canvas .......................................................199
Figure 15-6: Popup Menu................................................................................................200
Figure 15-7: Insert Object Box ........................................................................................200
Figure 15-8: Program Menu ............................................................................................201
Figure 15-9: OLE Library interfaces ...............................................................................201
Figure 15-10: PL/SQL Editor ..........................................................................................202
Lab Assignments
Lab Assignments

Table of Contents

1 Sales Order Processing System..........................................................................................211


2 FORMS................................................................................................................................212
2.1 Day - 1 ............................................................................................................................ 215
2.2 Day – 2 ........................................................................................................................... 217
2.3 Day - 3 ............................................................................................................................ 219
2.4 Day - 4 ............................................................................................................................ 221
2.5 Day - 5 ............................................................................................................................ 224
2.6 Day - 6 ............................................................................................................................ 225
2.7 Day - 7 ............................................................................................................................ 228
3 Reports 3.0 ...........................................................................................................................230
3.1 Day - 8 ............................................................................................................................ 230
3.2 Day - 9 ............................................................................................................................ 235
4 Graphics ...............................................................................................................................241
4.1 Day - 10 .......................................................................................................................... 241
Lab Assignments

1 Sales Order Processing System


SportyShop Sports International is an U.K. based company, which deals with sports
related goods. They have many products and since they have also diversified into
international market recently, the volume of business is growing. So the company is
finding it difficult to manage its transactions. You are required to understand the
requirements and develop a computerized system as per the need.

Specifications (Requirements) of the system

An invoice is a bill, which is send to the customer after the goods have been dispatched.
In most of the business concerns the items sold re on credit. When the customer receives
an invoice against the goods received by him, he verifies the amount on the invoice and if
the invoice is valid, he makes the payment.

The invoice is prepared on the computer and a printout of the invoice (3 copies) is taken.
Once copy of the invoice is send to the customer, second copy is send to the accounts
department and the third copy is retained by the invoicing department.

When the customer receives an invoice, he makes a payment to the accounts department.
An outstanding amount is the amount, which the customer has not yet paid. The balance
filed in ‘CUSTOMER’ table represents this amount.

Creditlimit is that maximum amount till which the customer is allowed to purchase goods
on credit. The outstanding balance should not exceed the Creditlimit.

The company has a sales department. The work of employees in sales department is to
implement marketing strategy and to convince the customers. They have to strike a deal.
They are given a specific target i.e. the number of customers. The status indicates the
target, which he has achieved.

The tables required for the above system have already been Normalized for you. The
validations for the data entry forms and the reports that are required to be generated have
also been specified.
Lab Assignments

2 FORMS
Solve the following based on the tables given below:

Tables

1. Salesmen Table

Primary Key: (Repid)

Name Null? Type


-----------------------------------------------------------------------------------------------
Repid Not Null Number (4)
Repname Varchar2 (10)
Target Number
Status Number (1)

2. Customer Table

Stores customer information.

Primary Key : (CustId)

Foreign Keys : (Repid references SalesMen(Repid)

Name Null? Type


-----------------------------------------------------------------------------------------------
Custid Not Null Number (6)
Name Varchar2 (45)
Address Varchar2 (40)
City Varchar2 (30)
State Varchar2 (2)
Zip Varchar2 (9)
Area Number (3)
Phone Varchar2 (9)
Repid Not Null Number (4)
Creditlimit Number (9, 2)
Comments Long
Balance Number (9, 2)
Lab Assignments

3. Product Table

To store product description.

Primary Key : Prodid

Name Null? Type


-----------------------------------------------------------------------------------------------
Prodid Not Null Number (6)
Ddescrip Varchar2 (30)

4. Price Table

To store the price of the product for a gien period.

Primary Key : Prodid + Startdate


Foreign Key : Prodid references Product(Prodid)

Name Null? Type


-----------------------------------------------------------------------------------------------
Prodid Not Null Number (6)
Stdprice Number (8, 2)
Minprice Number (8, 2)
Startdate Not Null Date
Enddate Date

5. Ord Table

To store the order information.

Primary Key : Ordid


Foreign Key : Custid references Customer(Custid)

Name Null? Type


-----------------------------------------------------------------------------------------------
Ordid Not Null Number (4)
Orderdate Date
Commplan Varchar2 (1)
Custid Not Null Number (6)
Shipdate Date
Total Number (8, 2)
Shipped Varchar2 (1)
Paid Varchar2 (1)
M_O_P Number (1)
Lab Assignments

6. Item Table

To store information about items in a given order.

Primary Key : Ordid + itemid


Foreign Key : Ordid references Ord(Ordid)
: Prodid references Product(prodid)

Name Null? Type


-----------------------------------------------------------------------------------------------
Ordid Not Null Number (4)
Itemid Not Null Number (4)
Prodid Number (6)
Actualprice Number (8, 2)
Qty Number (8)
Itemtot Number (8, 2)

The Forms, Reports and Graphics created by you in these assignments constitute a Sales
Order Processing Application. Your Final Application will look as follows:

Figure 11
Lab Assignments

Your individual menus in the above application will look as follows:

Figure 12

2.1 Day - 1
1. Create a block based on Salesmen table using the Data Block Wizard with scroll
bars and integrity constraints. Explore the Runform menu. What does the option
Query -> Count Hits do? Are any triggers generated?
Lab Assignments

Your form should look as follows:

Figure 13

2. Create a form with a block based on Customer table so that your output looks as
shown below.
Ø Show the scroll bar
Ø Enforce integrity constraints
Ø Left align all the column text
Ø Give the proper description of column names at the time of block creation

Figure 14
Lab Assignments

2.2 Day – 2
1. Create a Master-Detail form using Salesmen and Customer tables. Enforce
integrity constraints. Change the properties of relation object and see how the
master-detail relationship works. Your output should be as follows:

Figure 15

2. Create a form using Customer table. Create a control block to contain the push
buttons. When you click on Execute button, it should execute the query for the
custid entered in the field. If no custid is entered, it should give you a message
indicating that you have to enter custid. Write appropriate code in the Save,
Cancel and Quit buttons

Hint: Use of Pre-Query trigger


Lab Assignments

Figure 16

3. Create a form having multi-record based on Customer table and a control block.
The output is as shown below. The control block should have a radiogroup and a
check box in addition to other items. As soon as you click on any of the radio
buttons it should perform query in the sorting order ascending or descending
depending on whether the check box is checked or not.

Hint: Use When-Radio-Changed trigger and Set_block_property.

Figure 17
Lab Assignments

2.3 Day - 3
1. Create a form as shown below based on the Customer table. As soon as a query is
performed the name of the salesman should be displayed in the display item
‘Representative’

Hint: Use Post-Query trigger

Figure 18

2. Create a form as shown below based on the Customer table to add a new customer
performing all validations. Enforce integrity constraints. When you enter existing
custid and tab out, a message should be displayed indicating that the custid
already exists and the control should remain in the same field. The Comments
field should be multi-line and have a vertical scroll bar.

When you enforce integrity constraints, what are the triggers generated? What do
these triggers do?
Lab Assignments

Figure 19

3. Create a Master-Detail form based on Product-Price tables to add new product


and the prices for it for a given period.

As soon as you enter the product id and tab out then, if it exists in the database,
query should be executed to display the product description. The corresponding
records in the price table should be displayed and the control should move to the
new record in the Price block to enter the prices for a certain period.

If the Product if does not exist in the database then on tabbing out the control
should move to description field.
Lab Assignments

Figure 20

2.4 Day - 4
1. Create a form based on Customer table. Create an Lov named ‘Lov_Cust’ sorted
on Custid giving two columns Custid and Name. Create another Lov named
‘Lov_Name’ sorted on Name having two columns Custid ad Name. Create two
Push buttons with Labels ‘Custid’ and ‘Name’. When you click on ‘Custid’
button, ‘Lov_Cust’ should get attached to ‘Custid’ item. When you click on
‘Name’ button, ‘Lov_Name’ should get attached to ‘Custid’ item.

2. Create a form having block based on customer table and a control block.

Ø Create a Content canvas and place Custid and Name items on it


Ø Create a Stack canvas ‘ADDRESS’ and place the Address, City, State, Zip
items on it
Ø Create a Stack canvas ‘FINANCE’ and place the Area, Phone, Repid,
Creditlimit. Balance items on it
Ø Create a Stack canvas ‘COMMENTS’ and place the Comments item on it
Ø Create two buttons ‘Prev’ and ‘Next’ in the Control block and place them
on the content canvas
Ø When you click on ‘Next’ the subsequent canvas to the displayed canvas
should be shown. For example, if the display order of the canvases is
‘ADDRESS’, ‘FINANCE’ and ‘COMMENTS’ and if ‘ADDRESS’ canvas
is the current canvas then the canvas to be displayed next is ‘FINANCE’
Ø Similarly, when you click on ‘Prev’ then the previous canvas for the
current canvas should be shown
Ø The output should be as shown in the figures below:
Lab Assignments

Figure 21

Figure 22
Lab Assignments

Figure 23

3. Simulate the Form as above using Tab canvas.


Lab Assignments

2.5 Day - 5
1. Create a Master-Detail form based on Ord-Item tables to generate an order.
Implement the following in it:
Ø Create a display item to display the name of customer
Ø Attach an LOV to Custid field
Ø Complan and M_O_P (Mode of Payment) should be RadioGroups. Values
for Complan should be ‘A’, ‘B’ and ‘C’. Values for mode of payment are
‘1’ indicating Cash, ‘2’ Cheque and ‘3’ D/D.
Ø The itemid should be autogenerated and a non-navigable item
Ø Prodid should be a list item. Populate it with a runtime record group
Ø As soon as prodid is selected the corresponding actual price should be
displayed. This price should be such that it is the standard price of the
product for which the orderdate is between the Startdate and Enddate
Ø Put a check that Shipdate should be greater that Orderdate
Ø If the customer has not paid the amount, then his balance should be
credited by that amount in the customer table. (Use Post-Insert trigger)
Ø Use a general purpose Alert to display any messages
Ø The Total field is a display item that calculates the order total
Ø Same product should not appear more than once in a given order
Ø A running clock should be displayed at top right corner of the screen (not
shown in the figure below)

Figure 24
Lab Assignments

2. Create a vertical tool bar canvas. Attach it to a control block that has iconic push
buttons. Use the push buttons to form the tool bar and to perform operations like
add, delete, enter-query, execute query, cancel, save and exit the form. Create
another block based on the customer table and attach it to a content canvas. You
output should look as shown. For the iconic buttons make use of the .ico files in
<D2k Home>\TOOLS\DEVDEM20\BIN\ICON.

Figure 25

2.6 Day - 6
1. Create a multi-record form based on Salesmen table. Add two non-base table
items to that block that display the number of customers of each customer and the
total amount of the orders bagged by each salesman.
Implement the following:

Ø When you double-click on a repid, then a form showing his customers


should be displayed
Ø On double-clicking the customer, a form showing all his Orders should be
displayed
Ø On double -clicking on a given order a form showing invoice details for
that order should be displaye d. (See the invoice that you have created in
your previous example)

Hint: Use parameters and Call_form( )


Lab Assignments

In all you have to create four forms. The output is as shown below:

Figure 26

Figure 27
Lab Assignments

Figure 28

2. Create a PL/SQL Library. Write a program unit in it that maximizes your


window. Attach this Library to Form modules. Use this procedure such that as
soon as your runform is displayed, the window should get maximized.

3. Create an object library. In this library include the iconic buttons and the
horizontal and vertical toolbar created in the assignment 2 of day 5. use the iconic
buttons created in different forms.
Lab Assignments

2.7 Day - 7

1. Created a menu as shown below and attach the forms that you have already been
created.

Hint: Use Open_form, Run-Product etc.

Figure 29

Figure 30
Lab Assignments

Figure 31

Attach the forms as follows:

Menu Item Forms


Product Day 3 assignment 2
Salesmen Day 1 assignment 1
Customer Day 3 assignment 2
Invoice Day 2 assignment 1
Representative-Order Day 6 assignment 1
Representative-Customers Day 2 assignment 1

2. Implement the Calendar control as given in the book.

Steps:

Ø Create a block based on Emp table on a content canvas


Ø Create a block to hold the Calendar control on the stack canvas
Ø Create a push button to invoke the calendar control
Ø Create another push button so that when the user clicks on it after selecting the
year, month and day from the control, this date should be displayed in the
Hiredate field
Lab Assignments

3 Reports 3.0

3.1 Day - 8
1. Create a simple tabular report based on the ‘Customer’ table

Ø In the label page change the width of the following columns as follows:

1. Custid 4
2. Change the label for name column to ‘Customer’s Name’ and
specify width as 25
3. Address 15
4. Creditlimit 6
5. Balance 6

Figure 32

2. Create a break report based on the ‘Customer’ table. This report should display
the no. of customers for each sales representative and also should display the total
outstanding payments for all representatives. The output should be same as shown
below.
Lab Assignments

Figure 33

3. Create a simple Master/Detail report based on the Product and Price table. This
report displays the product details and its related price details. See the output
given below.
Lab Assignments

Figure 34

4. Create a Master/Detail report based on the ‘Orders’ and ‘Item’ table. Create two
queries based on these tables and join them by ‘Data Link Tool’

Ø There should be one formula column, which will calculate the tax by 0.4% per
order

Three Placeholder Columns to display the following


Ø Name and Address from the customer table (Write the PL/SQL code to fetch
values)
Ø Product Description for a particular order from the ‘Product’ table (Write
PL/SQL code to fetch values).
Lab Assignments

Figure 35

5. Create a lexical parameter report. This report is based on the ‘ORD’ table in
which the order details will be displayed along with the name and addresses of the
customers by using placeholder columns. Create your own parameter form
window to accept the query condition. The output and the parameter window
should display as shown below.
Lab Assignments

Figure 36
Lab Assignments

Figure 37

3.2 Day - 9

1. Create bind parameter report. This report shows the orders, which is placed by
customer for the period of user-defined ‘from-date’ to ‘to-date’ parameters. See
the sample output given below.
Lab Assignments

Figure 38

Ø Create the parameter form window to accept the from date and to-date user-
parameters value
Lab Assignments

Figure 39

2. Sample Output displays the details of the customer in the form of Mailing Report,
which can be used to print the addresses of the customer.
Lab Assignments

Figure 40

3. Create an invoice report as shown below. In this report create the layout on oyur
own.
Hint:
Create three queries for (order, item and salesmen table) in the data model
window and create the layout objects in the layout editor by selecting frame,
repeating frame, filed and boilerplate text tool.
Lab Assignments

Figure 41

4. Create ‘Matrix with group style report’ to display the “Order Information for all
Customers” i.e. the orders placed by him along with the product description and
each item’s quantity. It should also show the total no. of orders placed by him and
the quantity of a particular item sold along with the grand total of all item sold.
The output should look same as shown below.
Lab Assignments

Figure 42
Lab Assignments

4 Graphics

4.1 Day - 10

1. Create a Pie chart that displays the number of customers of each representative.
When you click on the pie slice the columnar information of the customers and
the order amounts for that repid should be displayed. When you click on the given
column then order and the order totals of that particular customer should be
displayed.

Figure 43
Lab Assignments

Table of Figures

Figure 1............................................................................................................................214
Figure 2............................................................................................................................215
Figure 3............................................................................................................................216
Figure 4............................................................................................................................216
Figure 5............................................................................................................................217
Figure 6............................................................................................................................218
Figure 7............................................................................................................................218
Figure 8............................................................................................................................219
Figure 9............................................................................................................................220
Figure 10 ..........................................................................................................................221
Figure 11 ..........................................................................................................................222
Figure 12 ..........................................................................................................................222
Figure 13 ..........................................................................................................................223
Figure 14 ..........................................................................................................................224
Figure 15 ..........................................................................................................................225
Figure 16 ..........................................................................................................................226
Figure 17 ..........................................................................................................................226
Figure 18 ..........................................................................................................................227
Figure 19 ..........................................................................................................................228
Figure 20 ..........................................................................................................................228
Figure 21 ..........................................................................................................................229
Figure 22 ..........................................................................................................................230
Figure 23 ..........................................................................................................................231
Figure 24 ..........................................................................................................................232
Figure 25 ..........................................................................................................................233
Figure 26 ..........................................................................................................................234
Figure 27 ..........................................................................................................................235
Figure 28 ..........................................................................................................................236
Figure 29 ..........................................................................................................................237
Figure 30 ..........................................................................................................................238
Figure 31 ..........................................................................................................................239
Figure 32 ..........................................................................................................................240
Figure 33 ..........................................................................................................................241

You might also like