Controlling Alerts at Run Time
There are built-in subprograms to modify an alert message, to modify alert button labels, and to display the alert, that returns the operator’s response to the calling trigger.
SET_ALERT_PROPERTY Procedure
Use this built-in to change the message which is currently assigned to an alert. At form startup, the default message (as defined in the Property palette) is initially assigned:
SET_ALERT_PROPERTY (‘alert_name’, property, ‘message’)
SET_ALERT_BUTTON_PROPERTY Procedure
Use this built-in to modify the label on one of the alert buttons:
SET_ALERT_BUTTON_PROPERTY (‘alert_name’, button, property, ‘value’)
SHOW_ALERT Function
SHOW_ALERT is how you show an alert at run time and return the operator’s response to the calling trigger:
Selected_button := SHOW_ALERT (‘alert_name’);
Alert_Name is the name of the alert which is described in the builder. You can instead specify an Alert_Id (unquoted) for this argument.
SHOW_ALERT returns a NUMBER constant which denotes that of the three possible buttons the user pressed in response to the alert. That numbers correspond to the values of three PL/SQL constants that are predefined through the Form Builder:
After displaying an alert which has more than one button, you can determine that button the operator pressed through comparing the returned value against the corresponding constants.
Example
A trigger which fires when the user attempts to delete a record may invoke the alert, shown opposite, to gain confirmation. If Yes selected by the operators, then the DELETE_RECORD built- in is known as to delete the current record from the block.
IF SHOW_ALERT (‘del_check’) = ALERT_BUTTON1 THEN
DELETE_RECORD;
END IF;