MESSAGE statement specifies a message that is displayed on the reserved message line.
Display value |
The information which will be displayed by the MESSAGE statement |
ATTRIBUTE clause |
Attributes that apply to the displayed information |
The display value can be:
The SPACE and CLIPPED operators can be used in the MESSAGE statement to organize the variables included into the display value.
DEFINE creat_date DATE,
file_name CHAR(30)
…
LET creat_date = 01/17/2010
LET file_name = "my_list.txt"
MESSAGE "The file ", file_name CLIPPED, 1 SPACE, "was created on ", creat_date
The above code will display the following message on the screen:
The file my_list.txt was created on 01/17/2010
The message remains on the screen until a menu is displayed, which uses the same line for being displayed, the erasing of the message can be avoided, if you specify another line as the message line. A message will be replaced by another message, if it is displayed.
If the message is longer than the message line, the message will be truncated from the right to fit the line.
A message is displayed on the message line. By default, the message line is the second line of the 4GL screen. If the menu is displayed it prevents the messages from being displayed as it uses the second line for displaying descriptions for the menu options. Even if there are no descriptions for the menu options, this line remains occupied by the MENU statement and MESSAGE text cannot be displayed if it uses the default message line.
Message text will also be invisible if the message line coincides with the form fields.
The default position of the message line can be changed by means of:
To clear the message line you can display an empty character string:
MESSAGE " "
There are some specific issues that concern the usage of the ATTRIBUTE clause in the MESSAGE statement.
By default, the message text is displayed with the NORMAL attribute. To specify other attributes, use the ATTRIBUTE clause. The below example displays the MESSAGE text in green and with reversed video:
MESSAGE "This is a green reversed message" ATTRIBUTE (GREEN, REVERSE)
The INVISIBLE attribute is ignored in the MESSAGE ATTRIBUTE clause.
It is possible to use sub-strings of CHAR, VARCHAR, STRING or TEXT data types in the MESSAGE statement by specifying the starting and ending points of the su-bstring in the square brackets:
MESSAGE "The goods descriptions were added to the table: ", descr [165, 170] CLIPPED, 1 SPACE, descr [405, 420]