4D v14.3

MESSAGE

Home

 
4D v14.3
MESSAGE

MESSAGE 


 

MESSAGE ( message ) 
Parameter Type   Description
message  String in Message to display

The MESSAGE command is usually used to inform the user of some activity. It displays message on the screen in a special message window that opens and closes each time you call MESSAGE, unless you work with a window you previously opened using Open window (see the following details). The message is temporary and is erased as soon as a form is displayed or the method stops executing. If another MESSAGE is executed, the old message is erased.

If a window is opened with Open window, all subsequent calls to MESSAGE display the messages in that window. The window behaves like a terminal:

  • Successive messages do not erase previous messages when displayed in the window. Instead, they are concatenated onto existing messages.
  • If a message is wider than the window, 4D automatically performs text wrap.
  • If a message has more lines than the window, 4D automatically scrolls the message window.
  • To control line breaks, include carriage returns — Char(13) — into your message.
  • To display the text at a particular place in the window, call GOTO XY.
  • To erase the contents of the window, call ERASE WINDOW.
  • The window is only an output window and does not redraw when other windows overlap it.
  • You can modify the font and size of characters displayed in the window by means of the "Interface" page in the Database Settings.

The following example processes a selection of records and calls MESSAGE to inform the user about the progress of the operation:

 For($vlRecord;1;Records in selection([anyTable]))
    MESSAGE("Processing record #"+String($vlRecord))
  ` Do Something with the record
    NEXT RECORD([anyTable])
 End for

The following window appears and disappears at each MESSAGE call:

In order to avoid this "blinking" window, you can display the messages in a window opened using Open window, as in this example:

 Open window(50;50;500;250;5;"Operation in Progress")
 For($vlRecord;1;Records in selection([anyTable]))
    MESSAGE("Processing record #"+String($vlRecord))
  ` Do Something with the record
    NEXT RECORD([anyTable])
 End for
 CLOSE WINDOW

This provides the following result (shown here on Windows):

Adding a carriage return makes a better presentation:

 Open window(50;50;500;250;5;"Operation in Progress")
 For($vlRecord;1;Records in selection([anyTable]))
    MESSAGE("Processing record #"+String($vlRecord)+Char(Carriage return))
  ` Do Something with the record
    NEXT RECORD([anyTable])
 End for
 CLOSE WINDOW

This provides the following result (shown here on Windows):

Using GOTO XY and writing some additional lines:

 Open window(50;50;500;250;5;"Operation in Progress")
 $vlNbRecords:=Records in selection([anyTable])
 $vhStartTime:=Current time
 For($vlRecord;1;$vlNbRecords)
    GOTO XY(5;2)
    MESSAGE("Processing record #"+String($vlRecord)+Char(Carriage return))
  ` Do Something with the record
    NEXT RECORD([anyTable])
    GOTO XY(5;5)
    $vlRemaining:=(($vlNbRecords/$vlRecord)-1)*(Current time-$vhStartTime)
    MESSAGE("Estimated remaining time: "+Time string($vlRemaining))
 End for
 CLOSE WINDOW

This provides the following result (shown here on Windows):

 
PROPERTIES 

Product: 4D
Theme: Messages
Number: 88

 
HISTORY 

Modified: 4D 2004

 
SEE ALSO 

CLOSE WINDOW
ERASE WINDOW
GOTO XY
Open window

 
ARTICLE USAGE

4D Language Reference ( 4D v12.4)
4D Language Reference ( 4D v11 SQL Release 6)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)