Vous êtes sur la page 1sur 49

ORACLE FORMS

Oracle forms are GUI based applications. It is to develop user friendly Interface for front end users in-order to query the details and Modify the details. Oracles GUI based forms tools are : Form Builder: It is used to design the layout of data entry form as well as to bind event driven PL/SQL code to the form for data validation and navigation purpose. Forms Compiler : It is used to compile the file, which was developed by the form builder . It creates a binary file and save the file to hard, which can be executed. Form Runtime : It is used to run the compiled file, which was created by Forms Compiler. To run an oracle form only the Forms Runtime is required. Application built using Oracle Form Builder contain the following components 1) Form Modules 2) Menus 3) PL/SQL Libraries 4) Object Libraries 5) Database Objects 1) Form Module It is primary object created using From Builder. Form Module is collection of objects such as data blocks, canvases, frames, items and event based PL/SQL code blocks bound to triggers 2) Menus The Menu module is a collection objects such as menu items, sub menu items and event based PL/SQL code blocks. 3) PL/SQL Libraries The library module is a collection of PL/SQL procedures, functions, Package Spec and Package Body. These can be accessed form the forms and menus. 4) Object Libraries The Object Library provides an easy method of reusing objects. We can use the Object Library to: Create, store, maintain, and distribute standard and reusable objects. Rapidly create applications by dragging and dropping predefined objects to your form. 5) Database Objects

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Oracles interactive tool ( SQL * PLUS ) allows the creation of database objects like stored procedures, functions and database triggers using appropriate SQL and PL/SQL sntax. FORM MODULE A form module consists of the following components 1) Block 3) Frames 5) Window Blocks : 1) A form contains one or more blocks. Blocks are logical containers and have no physical representation Only the item contained in a block are visible in the form interface. 2) A block, which is connected to a database object is called as Data Aware Block. A block, which is not connected to any database object is called as Control Block 3) A block can be Connected to a database object like a table, view or synonym. A block can also be connected to stored procedures. 4) A table, which is connected to block is called as base table. Items : 1) Items are objects contained in blocks. A Block serves as container for items where as Item serves as contained for data. 2) Some of Items of the block, bound to the columns of base table and some of the items of the block may not be bounded to columns of the base table. From : Form is an interface for end user, which enable the end user to give input to an application. Form consists of G.U.I components for user friendly. Forms are used to design GUI ( user interface ) , to enable the end user to display, add records, modify records, and delete records in table. It is a user friendly. ( select, insert, update, delete ) Note : 1) Reports are used only for display records. ( Select ) 2) Every thing is called as an object in the form builder and report builder. Form Builder Versions 4.5 / 6i / 9i / 10G A Form consists of following Interfaces 1) Layout Editor 3) Property Palette 5) Menu Editor 2) Object Navigator 4) PL/SQL Editor 6) Wizard 2) Items 4) Canvas Views 6) PL/SQL Code blocks

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

1) Layout Editor : The Layout Editor is a graphical design facility for creating and arranging interface items and graphic objects in a form. i.e Designing user friendly screens for end user. F2 is short cut key to access the Layout Editor (or) Window Module1 : Canvas2
Horizontal and Vertical Rulers

Layout Editor Context

Tool Palette

Canvas

Status Bar

Message Bar Canvas : A canvas is a surface--inside a window container--on which we 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 specfic window, set the canvas' Window property accordingly. Layout Editor Context : The title bar of the Layout Editor window displays context information, including the name of the current form, the name of the canvas being edited, and the name of the current block. When you create an item by drawing it on a canvas in the Layout Editor, Form Builder assigns the item to the current block, as indicated by Layout Editor block context. You can change Layout Editor block context using the Block poplist on the toolbar.

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Rulers : The horizontal and vertical rulers at the top and left side of the workspace provide a reference for sizing and arranging objects in the Layout Editor. To hide rulers, deselect the Rulers option on the View menu. Layout Editor ruler units can be set to character cells, inches, centimeters, or points. To display the Ruler Settings dialog, choose ViewSettingsRuler Settings. 2) Object Navigator The Object Navigator provides a hierarchical display of the objects in all open modules. Objects are grouped under the appropriate node. For example, all of the windows defined in a form module appear under the Windows node. The Windows node, in turn, appears under the appropriate form module object. F3 is a shortcut key to access the object navigator ( OR ) Window Object Navigator

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

3) Property Palette ( F4 is short cut key ) The Property Palette is where you set the properties of objects you create in form and menu modules.

4) PL/SQL Editor The PL/SQL Editor is where you enter and compile code objects. Code objects in Form Builder include event triggers, subprograms (functions and procedures), menu item commands, menu startup code, and packages.

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

5) Menu Editor : The Menu Editor is a Form Builder design tool you use (along with the Object Navigator and Property Palette) to create and arrange custom form menu modules and popup menus. 6) Wizards Form Builder includes several wizards to automate frequently performed tasks for both beginning and advanced users. Using a wizard, you can do the following: 1) create or modify a form 2) create or modify a data block 3) create and arrange items within a frame 4) create or modify an LOV 5) create or modify chart item Window : It is an area where we can display the canvas, we can have the multiple canvases in one window. Windows are of two types. 1) Model : We can not resize and minimize 2) Model Less window : User Friendly we can easily navigate other forms and minimize and maximize It is a default one. If it is required to make it as model window, set property Model : Yes Canvas : This object represents a background entity on which you place interface items, such as check boxes, radio groups, and text items.

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Developing a simple form A form can be developed in two ways 1) by using wizard 3) Manually In real time recommended one is manual. Eg: EmpNo Using Wizard Step1; Start the form builder 1) Select use Datablock Wizard 2) click on Next 3) select Table or view 4) Specify the name table 5) click on refresh 6) supply the user Id and password ( scott/tiger ) 7) select the required fields ( >> all ) 8) select create data block wizard and call 9) click on finish 10) layout wizard next it shows the name of the canvas 11) next 12) select the required fields to be displayed in the layout (Empno, Ename, Sal, Deptno) 13) Modify the Prompt and width as desired 14) Next 15) select the form/table as desired ( select table ) and click on next Form option is used to display one record at time where table option is used to more than one record at a time. 16) supply the frame title, No of record displayed, scroll bar and next 17) Finish 18) compile and run the form Program Compile all File administration Compile File ( Ctrl + T ) Program Run Form Client/Server ( Ctrl + R ) In place of last two steps : click on run tool ( shows in green color ) 19) to see the records go to query execute to display ; enter clear 20) Next >> Previous << 21) insert button , delete button, modify the record and save EmpName Salay DeptNo

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Layout shows as below

Runtime shows as below

+
X

Adding New Records ( enter the data and click on Save button )

Deleting records ( place the cursor on the required record and select delete ) Action Exit : to exit from the report. Developing a Simple form manually

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Above example manually Step1; Start the form builder 1) Select manually 2) Select Data block and create 3) Built new block manually

4) Data Block Property palette define the properties


Name : EMP_DETAILS ( as desired ) Navigation Style : Change Record No.of records displayed : 1 Data base block : yes Data source name : emp Data source columns : EMPNO, ENAME, SAL, DEPTNO 5) select Canvas and create

6) F2 to go canvas or double click


7) Design the form as shown below

8) Define the properties of text fields ( empno )


Name : empno ( as desired ) Item type : Text Item Enabled : yes Data type : Number Column Name : empno

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

9) Repeat the same procedure for remaining fields 10) Compile and run CONTROLS Tools on the Tool Palette are called as Controls List of Controls 1) Frame 4) Button 7) List Item 10) Tab Canvas 13) Rotate 16) Rectangle 19) Arc 22) Rounded Rectangle 25) OLE Container 28) Sound Item Frame : A frame is a graphic object that appears on a canvas. You use frames to arrange the items within a block. When you arrange items within a frame, you can, for example, create a form-style arrangement, define the distance between items and prompts, specify margins and offsets, and so on. Frames provide these benefits: 2) Text 5) Check Box 8) Display Item 11) Image Item 14) Magnify 17) Line 20) Polygon 23) Free hand 26) Active X Control 29) Hierarchical Tree 3) Text Item 6) Radio Button 9) Stacked Canvas 12) Select 15) Reshape 18) Ellipse 21) Polyline 24) Chart Item 27) Bean Area

1) A frame is an object with properties


2) When we associate a frame with a block, the items in the block are automatically arranged within the frame. 3) Each frame can be associated with a block 4) frames can be sub classed or included within the Object Library to enforce visual standards 5) We can store frames within the Object Library to provide a method of enforcing standards across a project or organization. You can create a series of "style sheets" for different types of blocks (single record, multi-record, or master-detail, for example). To reuse a frame that is stored in the Object Library, simply drag the desired frame to a canvas, then run the Layout Wizard to arrange an existing block within it. 6) Frames can be manipulated in the Object Navigator, Layout Editor, and Property Palette 7) Frames can be visible or invisible 8) If a frame is visible, it is displayed as a beveled rectangle. The contents of a frame appear within the frame's border. 9) The Layout Wizard uses frames to arrange items

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Text (

T ):

Text is used set labels on other controls such as Text Item, Headers and etc.

Text Item : It is for user inputs and to display details of some item. Text will be assign to every column of the table automatically. Properties ( IMP ) Name Item Type Enabled Multi Line Data Type Initial Value Required : as desired : TextItem : Yes / No : Yes/ No : as desired : as desired : Yes/ No ( No : Optional fields )

Lowest Allowed Value : as desired Highest Allowed Value : as desired Formula Summary Function Database Item Column Name : If required : if required : Yes/ No : as desired

Previous example focused on the text items ( Manual development of simple application ) Working with Check Boxes It is either enabled or disabled. We can select multiple check boxes at a time. Properties : Name Item Type Label : as desired : Check Box : It is a prompt value (JOB) : Yes

Value When Checked Data Type Initial Value

Value When Un Checked : No : Char ( depending on data ) : 5 ( as desired ) : Y ( default value ) Maximum Length Database Item : Yes Column Name : as per the requirement Requirement: CK_TEST table contains following fields create table CK_TEST( empno number(10), enmae varchar2(20), enable char )

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Model Form EMPNO : ENAME : Enabled : check box ( Y/N ) 1) create table using toad utility create table CK_TEST( empno number(10), ename varchar2(20), enable char ) 2)create data block with above said fields Properties : Name : EMP Navigation Style : change record Database Block : yes Data Source Type : table Data source Name : CK_TEST ( it is a name of the database table ) Data source Columns : click here and supply required columns of the table empno number(10), ename varchar2(20), enable char ) 2) create Layout Model as above said EMPNO ENAME ENABLED : Check Box Check Box Properties : Name Item Type Label : as desired : Check Box : ENABLE :Y

Value When Checked Data Type Initial Value : Char

Value When Un Checked : N Maximum Length :Y Database Item : Yes Column Name : enable :1

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Eg2: Check Box Label : JOB Value When Checked : Manager Value When Un Checked : Clerk
Create table CK_TEST ( empno number(10), ename varchar2(20), job varchar2(20))

Working with Radio Button : With radio buttons, user can choose only one selection. It is associated with the radio group. Radio Group : It is a collection of Radio Buttons. When user created a radio button, Radio Group will be created automatically. We can use the already existing group or we can create new Radio Group as desired. A radio group is an interface control that displays a fixed number of options that are mutually exclusive. Each option is represented by an individual radio button. A radio group can include any number of radio buttons. Radio buttons can be sized, positioned, and formatted independently of one another. Eg: EMPNO: EMPNAME: JOB : Manager / Supervisor / Clerk Gender : Male / Female
Layout as shown below.

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

create table Rd_Emp_Test( empno number(10), ename varchar2(20), JOB varchar2(20), Gender char) 1) Create data block with above fields 2) Radio Group for JOB When 1st radio button created, then Radio Group will be created automatically. Radio Button properties Name : Manager Label : Manager Radio Button Value : Manager Create 2nd Radio button for Supervisor and add to JOB Group ( old group) Create 3rd Radio button for CLERK and add to JOB Group( old group) 2) Set the properties of Radio Group Name : JOB Data Type : Char Initial Value : Manager Database Item : Yes Column Name : JOB Radio Button Group : We must specify a valid initial value unless one of the following is true: The item's Mapping of Other Values property has a non-null value. The value associated with one of the radio buttons in the group is Null. Note: A radio group in a null record appears with no radio button selected.

Display Item Display items are similar to text items with the exception that display items only store and display fetched or assigned values. Display items are generally used as graphic or as conditional text. It is advantageous to use display items when possible, because they require less memory than a text items.

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Runtime Behavior : End users cannot navigate to display items or edit display item values. Note: Multi-line display items do not automatically wrap text between characters or words; multiple line values break only at newline characters. A Simple Application to calculate and display PF, HRA and Gross Salary Output form as shown below

Create New data block by using Wizard / Manually Create data block with Empno, Ename, Job, Sal, and Comm Here PF , HRA and Gross Salary are non data block items. Create these as Display Item Display Items PF, HRA and Gross Salary Steps : 1) place the text and display Item on the canvas for these three 2) PF

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Properties Name : PF ( as desired ) Item Type : Display Item Data Type : number ( depends on data ) Maximum Length : 9 ( depends on data ) Initial value Calculation Calculation mode : formula Formula : : sal*0.10 : if required

Database Item : No Repeat the same HRA and Gross Salary HRA Formula : : sal*0.20 : sal + : PF + : HRA + nvl(: COMM,0)

Gross Salary Formula:

List Item JOB and DeptNo are to be provided from the list

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Create New data block by using Wizard / Manually Create data block with Empno, Ename, Job, Sal, Comm and Dept Here Job and Deptno are List Items Set the properties of JOB : Name Item Type Enabled : JOB ( as desired ) : List Item : Yes List Item value : MANAGER ( Actual value to be insert into table. Its data type should be matched with base table column type ) Repeat the same for other elements List Style : Pop List / Tlist / CombBox Pop List we can see all the values in the list at a time and can not be supplied user desired value Tlist we can see only one values in the list at a time. It provides scrolling option and can not be supplied user desired value. CombBox we can see all the values in the list at a time ( similar to Pop List ) and can also be supplied user desired values. It will not work for the foreign key columns. Data Type Initial value Database Item Column Name Set the properties of DEPT : Name Item Type Enabled : DEPT ( as desired ) : List Item : Yes List Item value : 10 ( Actual value to be insert into table. Its data type should be matched with base table column type ) List Element : SALES List Element : FINANCE List Element : DISTRIBUTION Data Type : Number List Item value : 20 List Item value : 30 List Item value : 40 : Char : as desired : Yes : JOB

Elements in list : List Element : MANAGER

Maximum length : as desired

Elements in list : List Element : OPERATIONS

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Maximum length : as desired Initial value Database Item Column Name Record Group This object represents an internal Form Builder data structure that has a column/row framework similar to a database table. However, unlike database tables, record groups are separate objects that belong to the form module in which they are defined. A record group object have an unlimited number of columns of type CHAR, LONG, NUMBER, or DATE provided that the total number of columns does not exceed 64K. Record group object column names cannot exceed 30 characters. Static Query based Non-Query based LOV ( List Of Values ) This object represents an internal Form Builder data structure that has a column/row framework similar to a database table. An LOV object is a scrollable popup window that provides the end user with either a single or multicolumn selection list. LOV is used to provide the list of values in the fields, to enable the user to select the value from the list. LOV is always associated with the Record Group Steps involved in creation of list of values ( LOV ) Step1 : Create Record Group : Enter the values manually : Based on the select statement get the values : Change the values dynamically. : as desired : Yes : DEPT

1) select Record Group and create


2) Data in the record group can b1) static values or 2) based on query Select static and OK Enter the name of the column : Type : Number Column Values : 3) Set the properties Name : RG_DEPTNO. Step2 : Create LOV 1) select LOV and create ( use LOV wizard / manually) 2) select existing group (RG_DEPTNO ) and NEXT 3) select record group columns ( DEPTNO )

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

4) select lookup for return item and NEXT 5) Title and NEXT 6) NEXT 7) return item : deptno and NEXT 8) FINISH 10) set the properties Name : LOV_LIST Automatic Display : Yes Column Mapping Properties : Column Names: Column Name in Record Group. Return Item : Return which field of the form ( JOB/DEPTNO)

Step3 : Add the above LOV to required field as desired. Go to canvas and set properties on DEPTNO field LOV List of values : LOV_DEPTNO Validate from list: Yes. Step4: Compile and run the form Property Class : Its group of properties. A property class is a named object that contains a list of properties and their settings. Once you create a property class you can base other objects on it. An object based on a property class can inherit the setting of any property in the class that makes sense for that object. Property class inheritance is an instance of subclassing. Conceptually, you can consider a property class as a universal subclassing parent. There can be any number of properties in a property class, and the properties in a class can apply to different types of objects. For example, a property class might contain some properties that are common to all types of items, some that apply only to text items, and some that apply only to check boxes. When you base an object on a property class, you have complete control over which properties the object should inherit from the class, and which should be overridden locally. Property classes are separate objects, and, as such, can be copied between modules as needed. Perhaps more importantly, property classes can be subclassed in any number of modules.

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Creation of Property class and to field 1) go to object navigator select property class and create 2) set the properties Name : PROP_EMP Subclass information : place the cursor and click on the add property button on the tool bar ( or properties menu and add properties ) and select the properties on by one Add to the required field Go to canvas select the field properties subclass select property class Property class name OK Note : Check the items in data block, the fields which are added with property shows with arrow and red color Visual attributes. Visual attributes are the font, color, and pattern properties that you set for form and menu objects that appear in your application's interface. Visual attributes can include 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, Charmode Logical Attribute, White on Black

Steps: 1) select and create

2) set the properties as desired, Name : VIS and others as desired 3) map to the filed
set property visual attribute group : VIS Difference between Property class and Visual attributes Property class 1) Group of Properties 2)We can not change dynamically Visual attributes

1)Group of Look and Feel properties Font,Color,Size..... 2)Visuval attributes can be changed SET_VA_PROPERTY Procedure

3)We can define the Triggers for Note : If same property given in both Property Class and Visuval can not define 3)We Property Class Attribute then Visuval Attribute will take the High priority.

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Note : If same property given in both Property Class and Visual Attribute then Visual Attribute will take the High priority. Working with Triggers Levels of Triggers : 1) Form Level 2) Data Block Level 3) Record Level 4) Item Level Form Level : it Will be executed once for the entire Form. Block Level : It Will be executed when we enter into the data block. Record level : It Will be executed for every record. Item Level : It Will be executed for the Particular Item. Types Of Triggers: 1)When Triggers 2)Validation Triggers 3) Transactional Triggers 4) Navigational Triggers 5)Query Time Triggers 6)On Triggers 7)Pre Triggers 8)Post Triggers 9)Mouse Event Triggers 10)Key Triggers. 11)Master Detail Triggers WHEN Triggers : WHEN-NEW-FORM-INSTANCE WHEN-NEW-BLOCK-INSTANCE WHEN-NEW-RECORD-INSTANCE WHEN-NEW-ITEM-INSTANCE WHEN-VALIDATE-RECORD WHEN-VALIDATE-ITEM WHEN-WINDOW-CLOSED WHEN-BUTTON-PRESSED WHEN-MOUSE-CLICK WHEN-MOUSE-DOUBLECLICK

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Eg1: WHEN-BUTTON-PRESSED Definition : Level form, block, or item Requirement : EmpNo EmpSal : : EmpComm : Total Sal : [ Find_Total_Sal ] when click on this button Total Sal value : sal + comm. Design the Layout : as above In this example EmpNo, EmpName, EmpSal and EmpComm are data base items Total Sal is not a data base item. It should be obtained form trigger on the button Total Sal text filed properties : Name : TOTAL Data Type : number Data base item : No Take a button and write the trigger Right click smart triggers WHEN-BUTTON-PRESSED :TOTAL:=:SAL+nvl(:comm,0); WHEN-WINDOW-CLOSED : it is a form level Create an alert and populate form the form level trigger Alert and create : Name : WIN_CLOSE Alert Style : stop, caution, note Title : window close Message : Window closing Button1 label : OK ( as desired ) Button2 label : CANCEL ( as desired ) Button3 label : Default button : Button1 declare x number; begin x:=show_alert('WIN_CLOSE'); if( x= ALERT_BUTTON1) then exit_form; end if ; end; EmpName :

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Show_Alert(alert_name) Return NUMBER; It returns one of the following: ALERT_BUTTON1, ALERT_BUTTON2, ALERT_BUTTON3. VALIDATION TRIGGERS WHEN-VALIDATE-ITEM - At any level WHEN-VALIDATE-RECORD - At Block Level, Form Level WHEN-VALIDATE-ITEM : when user changed the value in item Definition Level form, block, or item Eg: Trigger: declare x number; begin x:=show_alert('VAL'); -- Message(value has been changed): end; (or) empno should be from 100 to 10000 declare begin if ( :empno <100 or :empno>10000) then Message ( 'invalid input enter the value from 100 to 10000'); else Message('valid input'); end if; end; WHEN-VALIDATE-RECORD : when user changed the values of any fields and saved the record, then it will be fired. Definition Level : form or block Eg : Block level ( EMP ) declare begin Message( 'Record value has been change'); end;

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

NAVIGATIONAL TRIGGERS : These triggers will be fired When we navigate from one form to another form from one data block to another data block from one record to another record these triggers from one field to another field then these triggers PRE-FORM PRE-BLOCK PRE-RECORD PRE-TEXT-ITEM PRE-FORM Definition Level : form PRE-FORM : Perform an action just before Form Builder navigates to the form from "outside" the form, such as at form startup. begin Message('pre form instance has been fired '); end; WHEN-NEW-FORM-INSTANCE : Perform an action at form start-up.(Occurs after the Pre-Form trigger fires). begin Message('when new form instance has been fired '); end; POST-FORM : Perform an action before Form Builder navigates to "outside" the form, such as when exiting the form. begin Message('when new form instance has been fired '); end; PRE-RECORD WHEN-NEW-RECORD-INSTANCE POST-RECORD WHEN-NEW-FORM-INSTANCE WHEN-NEW-BLOCK-INSTANCE WHEN-NEW-RECORD-INSTANCE WHEN-NEW-ITEM-INSTANCE WHEN-NEW-FORM-INSTANCE POST-FORM POST-BLOCK POST-RECORD POST-TEXT-ITEM POST-FORM :

Definition Level : form or block PRE-RECORD : Perform an action before Form Builder navigates to the record level from the block level.

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

WHEN-NEW-RECORD-INSTANCE : Perform an action immediately after the input focus moves to an item in a different record. If the new record is in a different block, fires after the When-New-Block-Instance trigger, but before the When-New-Item-Instance trigger. POST-RECORD : Manipulate a record when Form Builder leaves a record and navigates to the block level. PRE-TEXT-ITEM WHEN-NEW-ITEM-INSTANCE POST-TEXT-ITEM

Definition Level : form, block, or item PRE-TEXT-ITEM : Perform an action before Form Builder navigates to a text item from the record level. WHEN-NEW-ITEM-INSTANCE : Perform an action immediately after the input focus moves to a different item. If the new item is in a different block, fires after the When-New-Block-Instance trigger. POST-TEXT-ITEM : Manipulate an item when Form Builder leaves a text item and navigates to the record level. PRE-BLOCK PRE-BLOCK : Perform an action before Form Builder navigates to the block level from the form level. WHEN-NEW-BLOCK-INSTANCE : Perform an action immediately after the input focus moves to an item in a block other than the block that previously had input focus. POST-BLOCK : Manipulate the current record when Form Builder leaves a block and navigates to the form level. Triggers Used at the Form Level: 1) PRE-LOGON 2) ON-LOGON 3) POST-LOGON 4) PRE-FROM 5) WHEN-NEW-FROM-INSATNCE 6) POST-FORMS-COMMIT 7) PRE-LOGOUT 8) ON-LOGOUT 9) POST-LOG-OUT WHEN-NEW-BLOCK-INSTANCE POST-BLOCK

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Triggers Used at the Block Level : 1) PRE-BLOCK 2) PRE-RECORD 3) WHEN-NEW-BLOCK-INSTANCE 4) WHEN-NEW-RECORD-INSTNACE 5) WHEN-VALIDATE-RECORD 6) POST-RECORD 7) POST-BLOCK 8) PRE-QUERY 9) POST-QUERY 10) PRE-SELECT 11) POST-SELECT 12) PRE-INSERT 13) POST-INSERT 14) PRE-DELETE 15) POST-DELETE 16) PRE-UPDATE 17) POST-UPDATE Triggers Used at the Item Level : 1) PRE-TEXT-ITEM 2) WHEN-NEW-ITEM-INSTANCE 3) WHEN-VALIDATE-ITEM 4) POST-TEXT-ITEM 5) KEY-NEXT-ITEM 6) WHEN-MOUSE-ENTER 7) WHEN-MOUSE-LEAVE 8) WHEN-MOUSE-CLICK 9) WHEN-MOUSE-DOUBLE-CLICK 10) WHEN-MOUSE-UP 11) WHEN-MOUSE-DOWN 12) WHEN-MOUSE-MOVE

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Order of Execution of Triggers :

1) PRE-LOGON Before Connecting to Database 2) ON-LOGON while Connecting to Database 3) POST-LOGON After Connecting to Database 4) PRE-FROM
Before Loading Form

5) PRE-BLOCK Before Cursor Moving to Block 6) PRE-RECORD Before Cursor Moving to Record 7) PRE-TEXT-ITEM Before Cursor Moving to Text Item 8) WHEN-NEW-FROM-INSTANCE While Appearing form to user 9) WHEN-NEW-BLOCK-INSTANCE While Appearing block to user 10) WHEN-NEW-RECORD-INSTANCE While Appearing Record to user 11) WHEN-NEW-ITEM-INSTANCE
While Appearing Item to user

12) KEY-NEXT-ITEM when pressed Tab Key 13) WHEN-VALIDATE-ITEM While leaving the text Item ( it will be fired when data is entered into the
text field )

14) POST-TEXT-ITEM After leaving the text item 15) WHEN-VALIDATE-RECORD after leaving last field of a record 16) POST-RECORD After leaving the Record 17) POST-BLOK After leaving the Block 18) POST-FORM Before exiting the Form 19) PRE-LOGOUT Before going to logout 20) ON-LOGOUT While Disconnecting from the database 21) POST-LOGOUT After Disconnecting from the database Navigation between Blocks 1) POST-TEXT-ITEM 2) POST-RECORD 3) POST-BLOCK 4) PRE-BLOCK 5) PRE-RECORD 6) PRE-TEXT-ITEM 7) WHEN-NEW-BLOCK-INSTANCE 8) WHEN-NEW-RECORD-INSTANCE 9) WHEN-NEW-ITEM-INSTANCE Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Navigation between Records : 1) WHEN-VALIDATE-ITEM 2) POST-TEXT-ITEM 3) WHEN-VALIDATE-RECORD 4) POST-RECORD 5) PRE-RECORD 6) PRE-TEXT-ITEM 7) WHEN-NEW-RECORD-INSTANCE 8) WHEN-NEW-ITEM-INSTANCE Navigation Between Items : 1) KEY-NEXT-ITEM 3) POST-TEXT-ITEM 4) PRE-TEXT-ITEM 5) WHEN-NEW-ITEM-INSTANCE
To Hide Fields of the Form Set property of the filed : Physical : Canvas : Null. Inserting data for hidden fields Write the PRE-INSERT Query at the Block Level Eg : EmpNo ( from the Sequence ) Hiredate : sysdate PRE-INSERT ( PL/SQL Editor ) Select EMPNO_SEQ.nextval into :EMP.EMPNO from Dual ; :EMP.hiredate:=sysdate; Validations : Length of the ENAME should not be more than 15 Go to ENAME filed and write the When validate Trigger. IF LENGTH ( :EMP.ENAME ) > 8 THEN Message('EMP Name Should Not be Greater than 8 Chars');

( only for tab )

2) WHEN-VALIDATE-ITEM

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

raise FORM_TRIGGER_FAILURE; END IF; Comparison of Salary and COMM Condition Comm Value Should not lessthan 100 and greater than Salary On COMM Filed write the WHEN-VALIDATE-ITEM Trigger If ( :EMP.COMM > :EMP.SAL OR :EMP.COMM <= 100 ) THEN Message( 'Invalid Commission'); Raise FORM_TRIGGER_FAILURE; END IF; If end user entered the data from top bottom the validation is fine. If end user entered the data in a random i.e entered the salary after the commission, then above will not work. In this scenario go for better to WHEN-VALIDATE-RECORD Trigger (WHEN-VALIDATE-ITEM may be or may not be required ) For the above write the WHEN-VALIDATE-RECORD Trigger at Block Level If ( :EMP.COMM > :EMP.SAL OR :EMP.COMM < = 100 ) THEN Message( Invalid Commission ); Raise FORM-TRIGGER-FAILURE; END IF;

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

MASTER-DETAIL TRIGGERS : Defining the Master/Parent and Detailed/Child Relation Ship : Example to establish relation ship between Dept ( Mater table ) and Emp ( Detailed table ) Using Wizard 1) Create Master Table ( Dept ) and Create Detailed Table (EMP)

2) Go to Data block Master table and select Relations create


Detailed Block : Emp ( name of the detailed Block ) (or) we can get from the select option at the right side Join Condition : dept.deptno=emp.deptno Click on OK Relation ship properties Name : DEPT-EMP ( Auto) Relation Type : Join ( Auto) Detailed Data Block : EMP ( Auto ) Join Condition : dept.deptno=emp.deptno ( Auto ) Delete record behavior : Non-Isolated, Extra Information : Prevent Master Level Operations : Yes / No Differed : Yes Automatic Query : Yes. Non-Isolated : (Default) The master record cannot be deleted, if associated detail records exist in the database Isolated : The master record can be deleted, but the associated detail records are not deleted from the database. Cascade : The master record can be deleted, and any associated detail records are automatically deleted from the database at commit time. When Master detail relationship system will generate following triggers ON-CHECK-DELETE-MASTER ON-CLEAR-DETAILS ON-POPULATE-DETAILS PRE-DELETE Isolated, Cascade

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Non-Isolated: ON-CLEAR-DETAILS ON-POPULATE-DETAILS ON-CHECK-DELETE-MASTER Isolated : ON-CLEAR-DETAILS ON-POPULATE-DETAILS Cascade : ON-CLEAR-DETAILS ON-POPULATE-DETAILS PRE-DELETE The following two are common three types ON-CLEAR-DETAILS ON-POPULATE-DETAILS Definition Level : form or block

On-Check-Delete-Master Trigger : Form Builder creates this trigger automatically when you define a master/detail relation and set the Delete Record Behavior property to Non-Isolated. It fires when there is an attempt to delete a record in the master block of a master/detail relation. On-Clear-Details Trigger : Fires when a coordination-causing event occurs in a block that is a master block in a Master/Detail relation. A coordination-causing event is any event that makes a different record the current record in the master block. On-Populate-Details Trigger : Form Builder creates this trigger automatically when a Master/Detail relation is defined. It fires when Form Builder would normally need to populate the detail block in a Master/Detail relation.

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

MANUALLY Only difference is 1st step 1) Create Master Table ( Dept ) and Create Detailed Table (EMP) Create block for master table (Dept) and Layout frame ( Dept ) 1) select data block and create. 2) Properties Name : DEPT Navigation Style : Same record / Change Record. No.of Record Displayed : 1 ( master and form type ) Database Block : Yes Data Source Type : table Query Data Source Name : DEPT Query Data Source Columns : deptno, dname, loc Scroll Bar : No ( since it is a single record output ) Create block Detailed Table and Layout frame ( Dept ) 1) select data block and create. 2) Properties Name : EMP Navigation Style : Same record / Change Record. No.of Record Displayed : 5 ( detailed and table type ) Database Block : Yes Data Source Type : table Query Data Source Name : EMP Query Data Source Columns : EMPNO, ENAME, SAL, COMM, DEPTNO Scroll Bar : Yes ( since it is 5 records output ) Note: both frames on the same canvas

3) Repeat the same procedure for relationship

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Master Detail Relationship : Properties : Co-Ordination Deferred : Yes Automatically : Yes Yes : on placing cursor automatically getting details Deferred=No, Automatic Query =No The default setting. When a coordination-causing event occurs in the master block, the detail records are fetched immediately. Deferred=Yes, Automatic Query=Yes When a coordination-causing event occurs, Form Builder defers fetching the associated detail records until the operator navigates to the detail block. Deferred=Yes, Automatic Query=No When a coordination-causing event occurs, Form Builder defers fetching the associated detail records until the operator navigates to the detail block and explicitly executes a query. Deferred=No, Automatic Query=Yes Not a valid setting.

Calling (one form) from (another form)


Develop the form, save and create exe file Creation of exe file: File Administration compile file (or ) use short cut ( ctrl + T) 1) CALL_FORM () 2) OPEN_FORM () 3) NEW_FORM () For these three Procedures form_name is common parameter. Form_name = location of the form ( eg : C:\CUST-FORMS\ EMP ) EMP.FMX is a name of the Form Module file. Extension .fmx should not be wile passing a form_name.

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

1) OPEN_FORM (opens a separate, independent form) : PROCEDURE OPEN_FORM (form_name VARCHAR2, activate_mode NUMBER, session_mode NUMBER, data_mode 1) Multiple Child Forms can be opened 2) activate_mode : activate_mode = ACTIVATE (The default.) Sets focus to the form to make it the active form in the application. activate_mode = NO_ACTIVATE Opens the form but does not set focus to the form. The current form remains current. NUMBER, paramlist_id PARAMLIST);

3) session_mode :
session_mode = NO_SESSION ( default ) Opened form can share the same database session as the form from which it was invoked. session_mode = SESSION it can create a separate session of its own. 4) data_mode : 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). data_mode = SHARE_LIBRARY_DATA At runtime, Form Builder will share data between forms that have identical libraries attached (at design time).

2) CALL FORM (calls a modal form) : PROCEDURE CALL_FORM (formmodule_name VARCHAR2, display switch_menu query_mode data_mode NUMBER, NUMBER, NUMBER, NUMBER,

paramlist_name VARCHAR2);

1) Only One Child can be Opened From the parent


2) display

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

display = HIDE (The default) Form Builder will hide the calling form before drawing the called form. display = NO_HIDE Form Builder will display the called form without hiding the calling form. 3) switch_menu switch_menu = NO_REPLACE (The default.) Form Builder will keep the default menu module of the calling form active for the called form. switch_menu = DO_REPLACE Form Builder will replace the default menu module of the calling form with the default menu module of the called form. 4) query_mode query_mode = NO_QUERY_ONLY (The default.) Form Builder will run the indicated form in normal mode, allowing the end user to perform inserts, updates, and deletes from within the called form. query_mode = QUERY_ONLY Form Builder will run the indicated form in query-only mode, allowing the end user to query, but not to insert, update, or delete records. 5) data_mode 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). data_mode = SHARE_LIBRARY_DATA At runtime, Form Builder will share data between forms that have identical libraries attached (at design time).

3) NEW_FORM (replaces the current form with a different form) PROCEDURE NEW_FORM ( formmodule_name VARCHAR2, rollback_mode query_mode data_mode NUMBER, NUMBER, NUMBER,

paramlist_name VARCHAR2 ); 1) Once Child from is Opened Parent from will be Closed.

2) rollback_mode :
rollback_mode = TO_SAVEPOINT (The default.) Form Builder will roll back all uncommitted changes (including posted changes) to the current form's savepoint. rollback_mode = NO_ROLLBACK Form Builder will exit 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. These locks can also occur when invoking Form Builder from an external 3GL program. The locks are still in effect when you regain control from Form Builder. rollback_mode = FULL_ROLLBACK Form Builder rolls back all uncommitted changes (including You cannot specify a

posted changes) that were made during the current Runform session.

FULL_ROLLBACK from a form that is running in post-only mode. (Post-only mode can occur when your form issues a call to another form while unposted records exist in the calling form. To avoid losing the locks issued by the calling form, Form Builder prevents any commit processing in the called form.)

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

3) query_mode: query_mode = NO_QUERY_ONLY (The default.) Runs the indicated form normally, allowing the end user to perform inserts, updates, and deletes in the form. query_mode = QUERY_ONLY Runs the indicated form in query-only mode; end users can query records, but cannot perform inserts, updates or deletes.

4) data_mode :
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). data_mode = SHARE_LIBRARY_DATA At runtime, Form Builder will share data between forms that have identical libraries attached (at design time). For most GUI applications, using OPEN_FORM is the preferred way to implement multiple-form functionality.

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Eg: Calling a Detailed form from the Master Master From ( Dept Details ):

When Click Emp Details Button it has to Detailed from with list employees working in a perticular Dept, which was selected in the Master form ( in the above selected Deptno : 10 )

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Master Form Dept No : 20

Detailed Form

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Develop The Master Form ( DEPT ) as shown below

Write the PRE-FORM trigger at the Master Form level to declare the Global Variable as shown below PRE-FORM :GLOBAL.DEPTNO:=0; -- Global variable decalaration. Write the the WHEN-BUTTON-PRESSED trigger with follwing Code WHEN-BUTTON-PRESSED :GLOBAL.DEPTNO:= :DEPT.DEPTNO; -- Current record Deptno will taken into the Global variable open_FORM('C:\CUST-FORMS\EMP');

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Develop the Detailed Form as new form Module as shown below.

Go Detailed Block ( EMP ) properties set where clause as shown below DEPTNO=:GLOBAL.DEPTNO Write trigger WHEN-NEW-FROM-INSTANCE at the Detailed block ( EMP ) WHEN-NEW-FROM-INSTANCE : execute_query(); Visual Attributes ; Visual attributes are the font, color, and pattern properties that you set for form and menu objects that appear in your application's interface. Visual attributes can include 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, Charmode Logical Attribute, White on Black

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Every interface object has a Visual Attribute Group property that determines how the object's individual visual attribute settings (Font Size, Foreground Color, etc.) are derived. The Visual Attribute Group property can be set to Default, NULL, or the name of a named visual attribute defined in the same module. There are several ways to set the visual attributes of objects: In the Property Palette, set the Visual Attribute Group property as desired, then set the individual attributes (Font Name, Foreground Color, etc.) to the desired settings. In the Layout Editor, select an item or a canvas and then choose the desired font, color, and pattern attributes from the Font dialog and Fill Color and Text Color palettes. Define a named visual attribute object with the appropriate font, color, and pattern settings and then apply it to one or more objects in the same module. You can programmatically change an object's named visual attribute setting to change the font, color, and pattern of the object at runtime. Subclass a visual attribute that includes visual attribute properties and then base objects on it that inherit those properties. Types of Visual Attribute :

1) Common : This is for all objects of the form Module ( from top to Bottom )
2) Prompt : This is only for Items Objects 3) Title : This is only for Frame Created the visual attribute as desired and go to property of the required Object and set Visual Attribute property. Property Class : This is similar to the Visual Attribute, the difference here we choose the Attributes as desired, where as in case of Visual Attributes we have use the provided attributes one only. Define the property class and go properties and set at the Sub Class Information If Visual Attributes and Property Class both are set on the same Object then Visual Attribute will be priority. In the Apps Applications these are not requited. Apps provides predefined property class from each end every item Simply we can select the Sub Class information in the Form Module Objects.

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Program Units : It is collection if Packages, Procedures and Functions This object represents a named PL/SQL function or procedure that you write in a form, menu, or library module. Although trigger objects are the primary mechanism for adding programmatic control to a Form Builder application, this object supplements trigger objects by allowing you to reuse code without having to enter it in multiple triggers. Scope of program unit is with in the Current Form only Defining Program Units : Mathematical Operations On Two numbers: Create the Block with the following non database items 1) Text Filed ( Num1 ) 2)Text Filed ( Num2 ) 3) Text Filed (Result ) 4) Button ( add) 5) Button ( sub ) Create the Block Manually Block Properties : Name : NUMBERS Data Base Database Datablock : No Query Allowed : No Query Data Source Type : None Insert Allowed : Yes ( to enter the value in item ) Update Allowed : yes Delete Allowed : yes Advance table DML Data Target type : None Go to Items of above Data block ( Non database block called as Control block ) and add the items Set the Properties Name : NUM1 Data Type : Number Database Item : No Query Allowed : No Prompt : Enter Num1 Repeat the same for remaining Create the Canvas Select all the items in the block and go to properties (f4)

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Select the Canvas to get the layout Layout will be as shown below

Write the Program units for Add and Sub of Numbers In this example for Add, procedure is taken For Sub, function is taken Go to program units and create 1) Create Package Spec Specify the Package Name : Numbers_Add_Sub_PKG Select Package Spec Write the following code and Compile and close it PACKAGE Numbers_Add_Sub_PKG IS procedure Numbers_Add_Proc( A number, B number, res OUT number); function Numbers_Sub_Funct( A number, B number ) return number; END;

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

2) Create Package Body Name should be same as Package Spec Write the following code in the package PACKAGE BODY Numbers_Add_Sub_PKG IS procedure Numbers_Add_Proc( A number, B number, res OUT number) as begin res:=nvl(A,0)+nvl(B,0); end; function Numbers_Sub_Funct( A number, B number ) return number as begin return ( nvl(A,0) - nvl(B,0)); end; END; Write the Triggers on Buttons to call the above procedure and Function Add Button WHEN-BUTTON-PRESSED Numbers_Add_Sub_PKG.Numbers_Add_Proc(:NUMBERS.Num1, :NUMBERS.Num2, :NUMBERS.Result ); Sub Button WHEN-BUTTON-PRESSED :NUMBERS.Result:= Numbers_Add_Sub_PKG.Numbers_Sub_Funct(:NUMBERS.Num1, :NUMBERS.Num2); PL/SQL Libraries : This PL/SQL library contains procedures that perform complex conversions. Scope is Entire Application ( across all forms ) Go to PL/SQL Libraries and Create Select program units and create Package Spec and Package Body as explained in previous example Save the PL/SQL Libraries ( Select LIB_002 and save) Eg : NUMBERS.pll Go to Form Module and Select Attached Libraries Select File System ( browse for the .pll ) C:\CUST-FORMS\NUMBERS.pll

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Select Attach It shows following Message Attached library name C:\CUST-FORMS\NUMBERS.pll contains non-portable directory specification. Remove path. ( if it is local Say No , if it is server Say Yes ) After attaching to Form Module use in the Application as above

Calling a report from the FORM :


Develop the report save and create exe file Creation of exe file File Administration compile file (or ) use short cut ( ctrl + T) .rdf source file ( report definition ) .rep executable file ( report executable program ) PROCEDURE RUN_PRODUCT (product NUMBER, module VARCHAR2, commmode NUMBER, execmode NUMBER, location NUMBER, paramlist_name VARCHAR2, display VARCHAR2); Built-in Type unrestricted procedure Enter Query Mode yes Eg: Declare L_Id PARAMLIST; Begin PROCEDURE RUN_PRODUCT (REPORTS, fil_path \ file.rep, SYNCHRONOUS, RUNTIME, FILESYSTEM, L_Id, NULL);

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Parameters product: Specifies a numeric constant for the Oracle product you want to invoke: FORMS specifies a Runform session. GRAPHICS specifies Graphics Builder. REPORTS specifies Report Builder. BOOK specifies Oracle Book. Module : Specifies the VARCHAR2 name of the module or module to be executed by the called product. Valid values are the name of a form module, report, Graphics Builder display, or Oracle Book module. The application looks for the module or module in the default paths defined for the called product. Commode: 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 end user cannot work in the form while the called product is running. ASYNCHRONOUS specifies that control returns to the calling application immediately, even if the called application has not completed its display. Execmode : Specifies the execution mode to be used when running the called product. Valid numeric constants for this parameter are BATCH and 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 module or module you want the called product to execute, either the file system or the database. Valid constants for this property are FILESYSTEM and DB. Paramlist_name or paramlist_ID : Specifies the parameter list to be passed to the called product. Valid values for this parameter are the VARCHAR2 name of the parameter list, the ID of the parameter list, or a null string (''). To specify a parameter list ID, use a variable of type PARAMLIST. You can pass text parameters to called products in both SYNCHRONOUS and ASYNCHRONOUS mode. However, parameter lists that contain parameters of type DATA_PARAMETER (pointers to record groups) can only be passed to Report Builder and Graphics Builder in SYNCHRONOUS mode. (SYNCHRONOUS mode is required when invoking Graphics Builder to return an Graphics Builder display that will be displayed in a form chart item.) Note: You can prevent Graphics Builder from logging on by passing a parameter list that includes a parameter with key set to LOGON and value set to NO. Note: You cannot pass a DATA_PARAMETER to a child query in Report Builder. Data passing is supported only for master queries.

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

display: Specifies the VARCHAR2 name of the Form Builder chart item that will contain the display (such as a pie chart, bar chart, or graph) generated by Graphics Builder. The name of the chart item must be specified in the format block_name.item_name. (This parameter is only required when you are using an Graphics Builder chart item in a form.) Execution of DDL commands PL/SQL Editor ( Trigger ) FORM_DDL( create table my_emp ( eno number(9), ename varchar2(50, salary number(9) ) Note : DML and DCL commands can be executed directly from the trigger PL/SQL code. Canvases : These are of five types : 1) Content, 2)Stacked, 3) Horizontal Toolbar, 4) Vertical Toolbar, and 5) Tab pages Content Canvas : The most common canvas type is the content canvas (the default type). A content canvas is the "base" view that occupies the entire content pane of the window in which it is displayed. You must define at least one content canvas for each window you create. Stacked Canvas : A stacked canvas is displayed atopor stacked onthe content canvas assigned to the current window. Stacked canvases obscure some part of the underlying content canvas, and often are shown and hidden programmatically. You can display more than one stacked canvas in a window at the same time. Working with stacked canvas : It can be showed and hidden dynamically Stacked canvas is to be placed on the content canvas Eg: Content canvas ( default ) Deptno Dname loc );

Stacked canvas Emp ename sal dept

Here dept no is 20 then stacked canvas has to be displayed and initially canvas should be hidden

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Steps

1) create the dept block by using wizard ( form type) ( default canvas is content type)
Prop Name : CONT ( as desired )

2) go to tool palette and select stacked canvas and place on the previous canvas ( CONT )
Prop Name : stack ( as desired )

3) create the emp data block by using wizard or manually ( table type with 5 records ).
4) Establish the relationship between master and detailed block

5) To set the canvas priority go to window property functions Primary Canvas CONT 6) To hide the stack canvas initially write the trigger at form level
When_new_form_instance hide_view(stack); 6) to hide the stack canvas dynamically when dept no is 20, then write trigger on the dept block WHEN-NEW-RECORD-INSTANCE begin if( :dept.deptno=20 ) then GO_BLOCK ('EMP'); SHOW_VIEW('STACK'); EXECUTE_QUERY; GO_BLOCK('DEPT'); ELSE HIDE_VIEW('STACK'); END IF; end; eg2) : when click on button ( placed on the content canvas ), the stacked canvas to be displayed. Toolbar Canvas : A toolbar canvas often is used to create toolbars for individual windows. You can create two types of toolbar canvases: horizontal or vertical. Horizontal toolbar canvases are displayed at the top of a window, just under its menu bar, while vertical toolbars are displayed along the far left edge of a window.

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Working with Tool bar canvas 1) Horizontal and 2) Vertical Steps

1) Create the Dept block and canvas as content type ( Name : CONT ) 2) Create 2nd canvas and set canvas as Horizontal Toolbar ( Name : HT ) 3) Create 3rd canvas and set canvas as Vertical Toolbar ( Name : VT ) 4) Go to object navigator window Property Palette
Primary Canvas : CONT Horizontal Vertical : HT : VT

5) Object Navigator HT
Design the layout : place the required components such as buttons, Text fields, Radio Buttons Write the triggers on the components as desired

6) Object Navigator VT
Design the layout : place the required components such as buttons, Text fields, Radio Buttons Write the triggers on the components as desired Tab Canvas : A tab canvasmade up of one or more tab pages allows you to group and display a large amount of related information on a single dynamic Form Builder canvas object. Like stacked canvases, tab canvases are displayed on top of a content canvas, partly obscuring it. Tab pages (that collectively comprise the tab canvas) each display a subset of the information displayed on the entire tab canvas. Requirement : To display 1) Dept details in the First Page 2) Emp details in the second page Steps 1) Start From Builder and go to object navigator by canceling wizard 2) Create Canvas and set property : canvas type : tab canvas 3) Object Navigator Canvas Tab Pages create two pages ( one is for dept and another is for emp) 4) Set the labels on theses two pages ( First Page : DEPT, Second Page : EMP ) 5) Go to layout of the Canvas 6) Tab Page layout : First Page ( DEPT ) right click create data block wizard for DEPT table ( layout will also be created ) select the Tab Page as DEPT while creating layout 7) Tab Page layout Second page ( EMP ) create data block wizard for EMP table ( layout will also be created ) select the Tab Page as EMP while creating layout 8) create Master and Detail relationship between DEPT and EMP tables

Compiled and Developed By M.Nageswar Rao B.Tech, MBA

Vous aimerez peut-être aussi