首页 > 代码库 > Displaying Modal Window Messages in Oracle Forms Using Show_Alert
Displaying Modal Window Messages in Oracle Forms Using Show_Alert
You can display modal windows in Oracle Forms to display normal messages, error message or asking for confirmation eg. on deleting a record or saving a record etc. using show_alert command.
These modal window messages can be shown using Alert option in Oracle forms.
This is the screen shot below for this example:
You can download this form from the following link: Modal_Msgt.fmb
For this example I have created three alerts with the following names:
1. Good_Msg
2. Error_Msg
3. Ask_Alert
The following code is written for "Show Good Message" button to display a normal message, you can use this code in any PLSQL block:
Declare
-- create a numeric variable to hold show_alert return value
nalertbutton number;
Begin
-- set the message for alert
set_alert_property(‘good_msg‘, alert_message_text, ‘Records saved successfully.‘);
-- after below statement the execution will hold till you click on ok.. becuase it is an modal window
nalertbutton := show_alert(‘good_msg‘);
:alertblock.result := ‘That was a good message.‘;
-- after this you can perform any task...
End;
The following code is written for "Show Error Message" button to display an Error message:
Declare
-- create a numeric variable to hold show_alert return value
nalertbutton number;
Begin
-- set the message for alert
set_alert_property(‘error_msg‘, alert_message_text, ‘An error occurred.‘);
-- after below statement the execution will hold till you click on ok.. becuase it is an modal window
nalertbutton := show_alert(‘error_msg‘);
:alertblock.result := ‘That was an ERROR message.‘;
-- after this you can perform any task...
End;
-- create a numeric variable to hold show_alert return value
nalertbutton number;
Begin
-- set the message for alert
set_alert_property(‘error_msg‘, alert_message_text, ‘An error occurred.‘);
-- after below statement the execution will hold till you click on ok.. becuase it is an modal window
nalertbutton := show_alert(‘error_msg‘);
:alertblock.result := ‘That was an ERROR message.‘;
-- after this you can perform any task...
End;
The following code is written for "Ask Confirmation" button to ask for a confirmation:
Declare
-- create a numeric variable to hold show_alert return value
nalertbutton number;
Begin
-- set the message for alert
set_alert_property(‘ask_alert‘, alert_message_text, ‘Confirm Yes or No?‘);
-- after below statement the execution will hold till you click on ok.. becuase it is an modal window
nalertbutton := show_alert(‘ask_alert‘);
-- now check which button or answer have been choosen
if nalertbutton = alert_button1 then
:alertblock.result := ‘You choose Yes.‘;
else
:alertblock.result := ‘You choose No.‘;
end if;
-- after this you can perform any task...
End;
-- create a numeric variable to hold show_alert return value
nalertbutton number;
Begin
-- set the message for alert
set_alert_property(‘ask_alert‘, alert_message_text, ‘Confirm Yes or No?‘);
-- after below statement the execution will hold till you click on ok.. becuase it is an modal window
nalertbutton := show_alert(‘ask_alert‘);
-- now check which button or answer have been choosen
if nalertbutton = alert_button1 then
:alertblock.result := ‘You choose Yes.‘;
else
:alertblock.result := ‘You choose No.‘;
end if;
-- after this you can perform any task...
End;
See also http://www.foxinfotech.in/2015/02/using-single-alert-for-messages-and-confirmation-messages.html
Displaying Modal Window Messages in Oracle Forms Using Show_Alert
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。