Oracle Form
Alert
In the
name of Allah, Most Gracious, Most Merciful
Praise
be to Allah, blessing and peace be upon our prophet Mohammed, his family and
his companions. After that,
Oracle
forms is quite aware of the need of the
user interactive messages. For this purpose
it specifies a form object called 'Alert' An Alert creates a modal window like with a tailored button actions fits his needs
In
fact, the user needs an application to realize and prospect his needs to
facilitate his job tasks at the least expected time and effort.
One of the ways that leads to an application
user satisfaction is creating a dialog with him as if he is setting at a
restaurant talking with the waiter about his preferences through these Alert
buttons that enable interactive message. It grants more secure and flexible interactive choices.
Task Definition:
Create and display an Alert message.
Task Solution:
There are two ways for performing this task:
1. Pro-grammatically.
2. Manually.
Both
methods will display an interactive alert message. The only difference is in the programmatic method you can use only one Form's Alert with many customized message text as needed. On the other hand, the non-programmatic method needs you to create a predefined form's Alert for every interactive message, since it uses the text message defined in the for's Alert property.
I will discuss the programmatic methods for it's flexibility and reliability.
I will discuss the programmatic methods for it's flexibility and reliability.
Now, let's assume
programmatic Our requirement is to create and display an interactive message to the application user before taking a specific action as ensuring him if he intending to delete the current record or not.
Three Steps to Follow:
1- Create a form's Alert; select an Alert object's node from Object navigator. Then, press the create button on the toolbar to create an
alert. Rename it DELETE_ALERT.
2- Create a KEY-DELREC Trigger
form level.
3- Use the following code:
3- Use the following code:
DECLARE
al_id ALERT;
al_btn NUMBER;
BEGIN
-- Check the Alert's name existence ----
al_id := Find_Alert('DELETE_ALERT');
IF Id_Null(al_id) THEN NULL;
ELSE
--- If the alert exists then label buttons
Set_Alert_Property(al_id,ALERT_MESSAGE_TEXT,'Do you want to delete this record ? ');
Set_Alert_Button_Property(al_id, ALERT_BUTTON1,LABEL,'YES');
Set_Alert_Button_Property(al_id, ALERT_BUTTON2,LABEL,'NO');
--- Display The Alert's message ---
al_btn := Show_Alert( al_id );
-- Start customizing Alert's buttons functionality --
IF (al_btn = ALERT_BUTTON1) THEN
DELETE_RECORD;
COMMIT_FORM;
ELSIF (al_btn = ALERT_BUTTON2) THEN
MESSAGE('Deletion is cancelled');
PAUSE;
GO_BLOCK('current_block');
END IF;
END IF;
END;
Note:
It's a quite good idea to create
a pl/sql library which includes an Alert procedure in a package to inherit this Alert
object and it's code to all forms application to simplify this task.
Learn more about:
Hope this helps...
My success only comes from Allah, pls. note your comments and
suggestions are great help for me in progress thanks in advance.
No comments :
Post a Comment