Call FORMS
Introduction
There are
three ways you can execute a form within a
form. These three ways are:
OPEN_FORM,
CALL_FORM and
NEW_FORM.
CALL_FORM
build-in subprogram
The
CALL_FORM built-in subprogram opens a
form with the same database connection and
can be run also in query mode.
NEW_FORM
build-in subprogram
The
NEW_FORM built-in subprogram opens a
form and closes the calling form.
OPEN_FORM
build-in subprogram
The
OPEN_FORM built-in subprogram opens a
form and its own database connection.
Global
Variable
You can use a
Global variable to pass a value from one
form to other. A Global Variable is a
binding variable that can be used by
multiple Form Modules.
Hands-on
Your client
wants to have another application Form to
query, insert, delete, and update their
product history prices. They want to open
the Form from their �Customer Order�
application.
It is their
requirement that the window size for product
price should be small enough to fit on a
small portion of their application. Also, it
is part of their requirement to have a Push
Button to click in order to open and run the
product history prices application from the
�Items� tab canvas. You should modify their
application to provide such request.
See Figure 13.
Your tasks
are:
1- Create the
product history prices Form.
2- Test all
its user functional requirements, such as
insert, delete, and update.
3- Create a
Push Button on the �Items� tab canvas to
open the Form that created from step 1.
4- Create and
compile trigger to call the Form that was
created from step 1.
5- Run and
test all user functional requirements.
F You
will learn how to: call another Form, create
and compile triggers, use tab canvas, use
�object navigator,� use �Data Blocks,� use
�Layout Editor,� use �Property Palette,� use
�Run Form,� and �Execute Query.�
Figure 13
Open a Module
In the �Object
Navigator� window, highlight Forms. Go to
the Main menu and choose �File,� select
�Open� to open an existing form (customer_orders_V10)
in the folder.
Save a Module
Click on the
�CUSTOMER_ORDERS_V10� form. The color will
change to blue. Then change then name and
save the Form name as version 11 (customer_orders_v11).
This way the original form is untouched.
Layout Editor
In the Main
menu, choose the �Tools� sub-menu and select
the �Layout Editor� option. In the Layout
Editor window, make sure that the Canvas box
contains your tab canvas. If not, click on
the down arrow next to its box and select it
and also make sure in the Layout Editor
window, the BLOCK box contains the ITEM
block. Or you can click on the ITEMS tap.
Create a New
FORM
Create a new
Form to query, insert, delete, and change
product history prices as an independent
form from this.
Change a
Module name and Save it
In the Object
Navigator, highlight the "Forms" item and
click on the "create" icon. A form (MODULEnn)
will be created. Click on the new form and
change its color to blue and type PROD_DE.
Go to the Main
menu, choose File and select the Save option
to save the Form in the folder as "prod_de."
Make it short for product price data entry.
Create a Data
Block
In the �Object
Navigator� window, highlight "Data Blocks,�
and click on the "create� icon. The �Create�
icon is in the vertical tool bar in the
�Object Navigator� window. It is a green �+�
sign.
New Data Block
In the �New
Data Block� window, choose the default
option �Data Block Wizard� and click "OK."
Welcome Data
Block
In the
�Welcome Data Block Wizard� window click
�NEXT.�
Type of Data
Block
Select the
type of data block you would like to create
by clicking on a radio button. Select the
default option �Table or View� and then
click �NEXT� again.
Selecting
Tables
Click on
�browse.� In the �Tables� window, highlight
the "PRICE� table; then click "OK."
Selecting
columns for the Data Block Wizard
To choose all
columns, click on the two arrow signs in the
�Data Block Wizard� window. To choose
selected columns, click on the one arrow
sign. For this hands-on exercise select all
columns, and click �next.�
Layout Wizard
End of the
Data Block Wizard and beginning of the
Layout Wizard
In the
�Congratulations� screen, use the default
checkmark radio button (Create the data
block, then call the Layout Wizard), and
click "Finish." You can also use the Data
Block Wizard to modify your existing data
block. Simply select the data block in the
Object Navigator and click the Data Block
Wizard toolbar button, or choose �Data Block
wizard� from the �Tools� menu.
Welcome screen
In the
�Welcome to the Layout Wizard� window, click
�Next.�
Selecting
canvas
In the �Layout
Wizard� window, select the "new canvas"
option. Canvas is a place that you will have
your objects such as columns, titles,
pictures, etc. If you have already had your
canvas, select the canvas and then click on
the next. Select "content," then click
�Next.�
Selecting
Columns for the Layout Wizard
In the �Layout
Wizard� window, select all the columns.
These are the columns that you want to
display them on the canvas. Then click
�Next.�
Change your
objects appearances
Change size or
prompt if needed. In this window, you can
enter a prompt, width, and height for each
item on the canvas. You can change the
measurement units. As a default the default
units for item width and height are points.
You can change it to inch or centimeter.
When you change size, click �Next.�
Selecting a
layout style
Select a
layout style for your frame by clicking a
radio button. Select "Form," if you want one
record at a time to be displayed. Select
�Tabular,� if you want more than one record
at a time to be displayed. Select "Tabular,"
and then click �next.�
Record layout
Type the Frame
Title (Product Data Entry), Records
Displayed (5), Distance between Records
values and checkmark the �Display Scrollbar�
box, when you use multiple records or the
�Tabular� option. Then click �Next.�
Congratulation
Screen
In the
�Congratulations� window, click "Finish."
Open and
change a property palette sheets
In the Layout
Editor, expand the Windows item and right
click on the WINDOWnn to open its Property
Palette.
In its
Property Palette, change the "X� position to
50. Change the "Width" length to 300. Change
the "Height" length to 150. Then, close the
window. The X and Y positions are where the
object is going to be displayed. Close the
window.
Save and
compile a Form
Save the Form
in the folder.
Then go to
File > Administration > Compile file to
compile it.
Now, go back
to the CUSTOMER_ORDERS_V11 form.
Create a Push
Button
In the Layout
Editor, click on the Push Button icon and
drag the �+� sign into the ITEMS canvas.
Click on any where in the canvas that you
wish to have your Push Button. Right click
on it and open its Property Palette.
Change a
property palette sheets
In its
Property Palette, change the name property
to PB_PROD_DE; then press the enter key.
Change "Label" to �Product Data Entry.�
Change the Keyboard and Mouse Navigate to
"NO.� Close the window.
Notice that on
the Object Navigator if the push button is
not in the �item� block, you should move it
to the �Item� block.
Now, you
should see five Push Button. The reason is
the ITEM block display 5 items at a time.
Right click on
the new Push Button and open its Property
Palette. In the Property Palette window,
change "Number of items displayed" to 1.
Press the enter key and close the window.
Now, you
should see only one push button. Adjust the
position of the push button if needed.
Create
WHEN-BUTTON-PRESSED trigger
Right Click on
the push button again to choose "Smart
Triggers," and select "WHEN-BUTTON-PRESSED."
PL/SQL Editor
In the PL/SQL
Editor, write a PL/SQL procedure to call the
�Product Price� data entry application.
(PL/SQL
Editor)
OPEN_FORM(�c:_de�);
Compile a
trigger
Compile the
trigger; and close the window.
Run a Form
Run the
application.
Execute Query
Click �Execute
Query.�
Navigate
Navigate
through the application options.
Click on the
�Product Data Entry� push button.
Then click
�Execute Query� again.
All products
will be displayed.
Click on the
"Enter Query" icon to query all product
prices for a specific product.
Close the
window.
Navigate
through the application to check all the
changes. When you are done with the testing,
close the application and save the changes.
�The
greatest discovery of my generation
is that a human being can alter his
life by altering his attitudes of
mind.� William James (1842 - 1910) |
Questions:
Q: What are
the ways you can execute a form in a form?
Q: What are
the differences between the OPEN_FORM,
CALL_FORM, and NEW_FORM build-in
subprograms?
Q: What is a
Global variable?
Q: How can you
create a form to call another form?
Q: How do you
compile a trigger in a form module?
Q: Your client
wants to have another application Form to
query, insert, delete, and update their
product history prices. They want to open
the Form from their �Customer Order�
application.
It is their
requirement that the window size for product
price should be small enough to fit on a
small portion of their application. Also, it
is part of their requirement to have a Push
Button to click in order to open and run the
product history prices application from the
�Items� tab canvas. You should modify their
application to provide such request.
See Figure 13.
Your tasks
are:
1- Create the
product history prices Form.
2- Test all
its user functional requirements, such as
insert, delete, and update.
3- Create a
Push Button on the �Items� tab canvas to
open the Form that created from step 1.
4- Create and
compile trigger to call the Form that was
created from step 1.
5- Run and
test all user functional requirements.
|