21. 4GL Statement Glossary : Message
 
Share this page                  
Message
Prints a message in the window.
Syntax
message stringexpr
  [with style = menuline | popup [(option = value
  {,option = value})]]
stringexpr
Specifies a character string containing the message to be displayed. If the character string is a constant, enclose it in quotes. The string is of the varchar datatype, and can be a 4GL name.
option
Specifies startcolumn, startrow, columns, or rows; used in the with style clause to locate and create a pop‑up
value
Specifies the value of each of the pop-up style option parameters listed above.
The values for startcolumn and startrow specify the coordinates of the upper left corner of the pop‑up form. The value can be a keyword, integer constant, or integer variable as follows:
default | 0
Indicates the VIFRED definition or default
int
Specifies a positive integer indicating the number of rows or columns from the origin. The origin (1,1) is the upper left corner of the screen.
intvar
Specifies a 4GL expression evaluating to 0 or a positive integer
Description
The 4GL message statement causes a character string to appear in the window, either on the menu line or as a pop‑up frame.
Use the with style option to specify where the message appears.
To display the message on the menu line (at the bottom of the window), use with style = menuline or omit the with style clause.
If you use with style = menuline, you can specify the length of time a message remains in the window. Place a sleep statement immediately after the with style = menuline statement, and the message remains visible for the number of seconds specified. See the sleep statement.
If a query statement immediately follows a menu-line style message statement, the message remains in the window until the action is completed. Menu-line style messages are truncated, if necessary, to fit the runtime screen width.
To display the message in a pop-up box at a window location you specify, use with style = popup. If there is not enough room in the window to start the pop‑up box at the specified location, the forms system adjusts the location to show the entire pop‑up box, if possible. If the pop‑up box is taller or wider than the window, then the forms system displays it in full‑screen mode.
If you use with style = popup, the instruction "[Press Return]" is automatically added to the message. The message stays on display until you clear it by pressing the Return key.
Pop‑up style messages are truncated, if necessary, to fit the specified box size. If no box is specified, a box large enough to accommodate the message text is drawn.
The value of rows, if specified, must be at least 4. Three of the rows are used by the display, leaving one line for text. If you want to display four lines of text, specify seven as the value of rows. The value of columns, if specified, must be at least 16.
Examples
Display a menu-line style message for three seconds:
message 'Please enter employee number';
sleep 3;
Display a message on the menu line until a database retrieval is completed:
message 'Retrieving employee name';
empform := select lname, fname from emp 
  where empnum = :empnum;
Display a pop-up style message on the number of rows retrieved:
empform := select lname, fname
    from emp
    where empnum = :empnum;
inquire_sql (rcount = rowcount); 
message 'Retrieved ' + varchar(:rcount) +
    ' rows' with style=popup;