alertmodal
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

- alert -- displays a modal alert window with a message and one or more buttons.
- alertcanceldelete -- displays a modal alert window with a message and two buttons: *Cancel* and *Delete*.
- alertcancelok -- displays a modal alert window with a message and two buttons: *Cancel* and *Ok*.
- alertdeletecancel -- displays a modal alert window with a message and two buttons: *Delete* and *Cancel*.
- alertnoyes -- displays a modal alert window with a message and two buttons: *No* and *Yes*.
- alertok -- displays a modal alert window with a message and one button: *Ok*
- alertokcancel -- displays a modal alert window with a message and two buttons: *Ok* and *Cancel*.
- alertoksmall -- displays a modal alert window with a message and one button: *Ok*
- alertrevertcancel -- displays a modal alert window with a message and two buttons: *Revert* and *Cancel*.
- alertsavecancel -- displays a modal alert window with a message and two buttons: *Save* and *Cancel*.
- alertsheet -- displays an alert sheet (attached to the current window) with a message and one or more buttons. Note: with the introduction of OS 11, Big Sur, sheets no longer appear to slide down from the title bar, but open a dialog centered on the active window.
- alertyesno -- displays a modal alert window with a message and two buttons: *Yes* and *No*.
- alertyesnocancel -- displays a modal alert window with a message and three buttons: *Yes*, *No* and *Cancel*.
- beep -- makes the computer speaker beep once.
- bigmessage -- displays a message alert.
- cancelok -- displays a modal alert window with a message and two buttons: *Cancel* and *Ok*.
- gettextokcancel -- displays a modal dialog that asks the user to enter an item of text.
- giantmessage -- displays a message alert.
- message -- displays a modal alert window with a message.
- noyes -- displays a modal alert window with a message and two buttons: *No* and *Yes*.
- nsnotify -- delivers a notification.
- okcancel -- displays a modal alert window with a message and two buttons: *Ok* and *Cancel*.
- rudemessage -- displays a message alert.
- statusmessage -- displays a message in the status bar at the bottom of the procedure window.
- stopalert -- displays a modal alert window with a warning icon, a message and one or more buttons.
- tallmessage -- displays a message alert.
- yesno -- displays a modal alert window with a message and two buttons: *Yes* and *No*.

History

Version | Status | Notes
10.0 | New | New 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.