alertsheet
alertsheet
TEXT
,
OPTION
,
VALUE

The alertsheet statement 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.

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 alertsheet statement displays an alert sheet (attached to the current window) with a message and one or more buttons. Unlike a floating alert however, the alertsheet is only associated with the form to which it is attached. This means you can access other windows while the dialog is still being displayed and only the form it is attached to is made inactive until the alertsheet is dismissed. In its simplest form, it displays the message with one button, Ok.

     alertsheet "The operation is complete"

#### Alert Options

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

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

Each of the available options are 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.

    alertsheet "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. Be careful not to add a space in the button list unless you want it to be part of the button name.

You can also specify each button separately, like this:

    alertsheet "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.

    alertsheet "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).

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

You can abbreviate the style down to a single letter.

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

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

    alertsheet "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.

    alertsheet "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*.
- alertmodal -- displays a modal alert sheet (not attached to any window) with a message and one or more buttons.
- 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*.
- 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.