Progress
Language Reference
MESSAGE Statement
Displays messages in the message area at the bottom of the window or in an alert box (or in an output stream — see the “NOTES” section). By default, an area at the bottom line of the window is reserved for Progress system messages. An area above that is reserved for messages you display with the MESSAGE statement.
SYNTAX
COLOR color-phrase
Displays a message using the color you specify with the COLOR phrase.
For more information on color-phrase, see the COLOR Phrase reference entry.
NOTE: The COLOR Phrase does not have any effect in a Windows environment.expression
An expression (a constant, field name, variable name, or expression) whose value you want to display in the message area. If expression is not character, it is converted to character before it is displayed. If you do not use this option, you must use either the SET or UPDATE option.
SKIP [ ( n ) ]
Indicates a number (n) of blank lines to insert into the message. The value of n can be 0. If you do not specify n, or if n is 0, a new line is started unless the current position is already the start of a new line.
You can only use this option with the VIEW-AS ALERT-BOX option.
VIEW-AS ALERT-BOX [ alert-type ]
Specifies that the message is displayed in an alert box rather than in the window message area. The value of alert-type determines the type of alert box. The possible values are:
BUTTONS button-set
Specifies what sets of buttons are available within the alert box. The possible button sets are as follows:
- YES-NO
- YES-NO-CANCEL
- OK
- OK-CANCEL
- RETRY-CANCEL
The name of each button set indicates the buttons in that set. For example, YES-NO contains two buttons labeled YES and NO; YES-NO-CANCEL contains three buttons labeled YES, NO, and CANCEL; OK contains a single button labeled OK. If you do not specify a button set, the default is OK.
TITLE title-string
Specifies a value to display in the title bar of the alert box.
SET field
Displays the expression you specified and SETs the field or variable you name. (It prompts the user for input and assigns the value entered to the field or variable.) You cannot test the field with the ENTERED function or the NOT ENTERED function.
UPDATE field
Displays the expression you specified and updates the field or variable you name. (It displays the current value of the field or variable, prompts for input, and assigns the value entered in the field or variable.) You cannot test the field with the ENTERED function or the NOT ENTERED function. For an alert box, field must be a LOGICAL variable. It sets the default button and returns the user’s choice. If the alert box has two buttons, they represent the values TRUE and FALSE, respectively. If the alert box has three buttons, they represent the values TRUE, FALSE, and unknown (?), respectively.
AS datatype
Defines field as a variable of type datatype. You must use this option or the LIKE option if field has not been previously defined.
LIKE field
Defines the field specified in SET or UPDATE as a database field or a previously defined variable.
FORMAT string
The format that you want to use to display the field used in the SET or UPDATE option. For more information on display formats, see the Progress Programming Handbook . If you do not use the FORMAT option, Progress uses the defaults shown in Table 31.
Table 32 shows the default formats for the Other expression.
Table 32: Default Data Type Display Formats Data Type Default Display Format CHARACTER x(8) DATE 99/99/99 DECIMAL ->>,>>9.99 HANDLE >>>>>>9 INTEGER ->,>>>,>>9 LOGICAL yes/no MEMPTR1 See the footnote at the bottom of the table. RAW1 See the footnote at the bottom of the table. RECID >>>>>>9 ROWID1 See the footnote at the bottom of the table. WIDGET-HANDLE >>>>>>9
- You cannot display a MEMPTR, RAW, or ROWID value directly. However, you can convert it to a character string representation using the STRING function and display the result. A ROWID value converts to a hexadecimal string, “0xhexdigits,” where hexdigits is any number of characters “0" through “9" and “A” through “F”. A MEMPTR or RAW value converts to decimal integer string.
AUTO-RETURN
Performs a carriage return when the field that is SET or UPDATEd is full.
IN WINDOW window
Specifies the window in which the message is displayed.
EXAMPLESIn this procedure, if you enter the number of a customer that does not exist, the procedure displays a message telling you the customer does not exist. If the customer does exist, the procedure displays the name and sales-rep of the customer.
The following example uses two alert boxes.
In
r-altbox.p
, each time you select an item from the selection list, the procedure displays an alert box to ask if you want to delete the customer. If you choose the No button, then another alert box informs you that the record was not deleted.NOTES
- The MESSAGE statement always sends messages to the current output destination. If the INPUT source is the terminal, Progress displays messages in the window and also sends them to the current output destination. Compiler error messages also follow this convention.
- If you don’t want messages sent to the current output destination, redirect the output to a named stream. Progress never writes messages to a named stream.
If you want to send output to a destination other than the terminal, and you do not want messages to appear on the terminal (and if you are not using the terminal as an input source), use one of the statements in Table 33.
Table 33: Suppressing Messages to the Terminal Operating System
Input From UNIX INPUT FROM /dev/null Windows INPUT FROM NULBe sure to use the INPUT CLOSE statement to close the input source.
- Progress automatically clears messages after any user interaction, such as a SET, UPDATE, or PAUSE statement, but not after a READKEY statement.
- In Microsoft Windows, the message text in VIEW-AS ALERT-BOX is limited to 511 bytes. If the text is longer than 511 bytes, it is truncated.
- When you use the MESSAGE SET or MESSAGE UPDATE statement to update a field, Progress does not process any validation criteria defined for that field in the database. For example, if the validation criteria for the customer.name field is as follows.
Use this statement.
Progress lets you enter any data, including data that does not start with the letter a, into the name field.
Use the MESSAGE statement to display a message, but use the SET statement or UPDATE statement to let the user change the data in a frame rather than in the message area.
- If you are displaying a message to the message line and the combination of the text and field you name in a MESSAGE UPDATE statement exceeds the length of the message line, Progress truncates the text to fit on the message line.
Here, the combination of the message text and the myvar variable exceeds 80 characters, so Progress truncates the message text.
- Using the MESSAGE statement to display decimal values results in truncating the nonsignificant zeros to the right of the decimal point.
The above procedure displays the following message.
Use functions such as STRING and DECIMAL to control the format of a display.
- If the APPL-ALERT-BOXES attribute of the SESSION system handle is TRUE, then all your messages are displayed in alert boxes. You can also direct all system messages to alert boxes by setting the SYSTEM-ALERT-BOXES attribute of the SESSION system handle to true. You can remove the message area for a window by setting its MESSAGE-AREA attribute to FALSE before it is realized.
- If you use the SET or UPDATE options in a graphical environment, Progress automatically displays the message as an alert box.
- By default, all text in an alert box is displayed on a single line. If you want to break lines within the text, you must explicitly insert SKIP options into the message.
- If you use the OUTPUT TO statement to divert Progress error and warning messages to an output stream, Progress also diverts messages from the MESSAGE statement the same way. For more information, see the OUTPUT TO Statement reference entry in this book.
- SpeedScript — The only valid options are: expression and SKIP.
SEE ALSO
COLOR Phrase, DECIMAL Function, Format Phrase, INTEGER Function, MESSAGE-LINES Function, STRING Function
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |