MSGBOX

 

Syntax:

 

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

 

Version Ref:  4.1

 

Description:

The MSGBOX processing command lets you display a 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 width of the window is determined by the longest line of text. The height of the window is determined by the number of text lines.

 

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 MSGBOX. For example:

 

       Then: msgbox "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. MSGBOX will display what is set as the keylabel for this key.

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

 

The arguments to MSGBOX (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).

 

MSGBOX is exactly the same thing as ERRORBOX except for the colors which are assigned to it. The colors for MSGBOX are POPUPNORMAL and POPUPINVERSE. 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
         If:
       Then: o="NO money on this record. Save it, Delete it, or Fix it?"
         If:
       Then: m="(s/d/f)==>"
       Then: msgbox("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: msgbox "File already exists!\nContinue?",
            "Press \rY\r or \rN\r", "YN"
         If: @BK eq "Y"
       Then: gosub mkfile