ERRORBOX

 

Syntax:

      Then: ERRORBOX(row,col) message,prompt,keylist

 

Version Ref:  4.1

Description:

The ERRORBOX processing command lets you display an error message in a popup window on the screen. It will display a string "message" in a popup window at a designated position on the screen until the user presses ENTER or a key from a specified list. The key pressed by the user can be captured and acted upon appropriately.

Row and Column

If row and column are supplied, the upper left corner of the window appears at the row and column coordinates. If row and column are not supplied, the window is centered on the screen. The upper-left corner of a screen is row,col ("1","1").

 

Width and Height

The longest line of text determines the width of the window. The number of text lines determines the height of the window.

Message

The message to appear in the window is a string expression. You can add additional lines to this message by placing a "\n" at the point where you want a new line to begin. All of the SHOW codes are available to ERRORBOX. For example:

      Then: errorbox "Text line 1\nText line 2"

Prompt

Prompt is the prompt you want to appear telling the user what keys can be used to remove the window (and/or take certain actions) to continue. The prompt appears in the lower-right corner of the window. If prompt is not specified, then the default prompt of "Press ENTER" is used.

Keylist

Keylist is the list of keys, in addition to ENTER, that will remove the window. These keys can be trapped and acted upon with further processing. If keylist is not specified, the ENTER key is the default for removing the window.

NOTES:

ENTER is the special key defined as ENTR. ERRORBOX will display whatever is set as the keylabel for this key.

After the message box is executed, @BK is set to the keystroke entered.

The arguments to ERRORBOX (row/col, the message, the prompt and the keylist) can be variables. If they are variables (or real fields), you must NOT put quotes around them. If they are literals, such as the keylist below (SLN), then they must be in quotes. Case is not significant (except if the key is a shifted key such as "@", then a 2 will not work, only a shifted 2 "@" will work).

ERRORBOX is exactly the same thing as MSGBOX except for the colors which are assigned to it. The colors for ERRORBOX are ERRORNORMAL and ERRORINVERSE. This environmental variables allow you to give a consistent look and feel to your programming by showing "errors" in one set of colors and "messages" (or navigational questions) in another set of colors.

 

Examples:

         If: 4 ne "0"
       Then: end
       Then: o="NO money on this record. Save it, Delete it, or Fix it?"
       Then: m="(s/d/f)==>"
       Then: errorbox("10","5") o,m,"SDF"
         If: @bk eq "S"
       Then: end
         If: @bk eq "D"
       Then: delete ; end
         If:      '<=== the F key in keylist will default here, so will ENTER.
       Then: restart
         If: exists(fn) gt "0"..
       Then: errorbox "File already exists!\nContinue?",
             "Press \rY\r or \rN\r", "YN"
         If: @BK eq "Y"
       Then: gosub mkfile