alertmodal
TEXT
,
OPTION
,
VALUE

The alertmodal statement displays a modal alert sheet (not attached to any window) with a message and one or more buttons.


Parameters

This statement has three parameters:

text – is the message to display in the alert.

option – The name of an option that modifies the operation of this statement. See below for descriptions of each option. The option can be specified in either upper or lower case.

value – The new value for this option.


Description

The alertmodal statement displays a modal alert sheet (not attached to any window) with a message and one or more buttons. In its simplest form, it displays the message with one button, Ok.

alertmodal "The operation is complete"

Alert Options

The appearance and operation of the alert can be modified by adding one or more pairs of option/value parameters to the alertmodal statement, like this:

alertmodal message,option1,value1,option2,value2,option3,value3,option4,value4

Each of the available options is described below.

BUTTONS

Use this option to define one or more custom buttons. The option value should be a comma separated list of buttons to include in the alert. The buttons must be listed in reverse order – the first button listed will be on the right and will be the default button if the Enter or Return key is pressed. This example displays an alert with three buttons.

alertmodal "Do you want to continue?","Buttons","Yes,No,Maybe"
if info("dialogtrigger") = "No"
    stop
endif
if info("dialogtrigger") = "Maybe"
    if rnd() > 0.5
        stop
    endif
endif
...
...
...

The procedure pauses until one of the buttons is clicked. As shown above, the procedure can use the info(“dialogtrigger”) to find out which button was clicked.

Note: Pressing the Enter or Return key is the same as clicking the first button (the button farthest to the right). If the alert contains a Cancel button, pressing the ESC button is the same as clicking on the Cancel button. If there is no Cancel button, the ESC key is ignored.

You can also specify each button separately, like this:

alertmodal "Do you want to continue?","Button","Yes","Button","No","Button","Maybe"

Notice that in this case the option name is button, not buttons.

TEXT

This option allows you to display additional text in the alert. This additional text is displayed in a smaller, non-bold style.

alertmodal "Operation complete!","TEXT",info("selected")+" records were processed."
STYLE

Apple has three styles for alerts – Warning, Critical, and Informational. Use the style option to set the alert style you want (the default is Warning).

alertmodal "Gadzooks! Negative balance","style","critical"

You can abbreviate the style down to a single letter.

alertmodal "Gadzooks! Negative balance","style","c"

You can also use ! for critical and ? for informational.

alertmodal "Gadzooks! Negative balance","style","!"

Note: At the time this was written, Apple displays Warning and Informational alerts exactly the same. Critical alerts are displayed with a yellow triangle icon.

ICON

Alerts normally appear with the Panorama icon in the upper left hand corner. You can specify a different icon with the icon option. Any image file can be used.

alertmodal "Gadzooks! Negative balance","icon","~/Pictures/DollarSign.png","style","!"

See Also


History

VersionStatusNotes
10.0NewNew in this version. This new statement supercedes the many other statements that earlier versions of Panorama included for displaying modal alerts. These statements are still available for compatibility with legacy databases, but the alertmodal statement offers more options and flexibility and is recommended for new applications.