PreviousNextIndex

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 ABL system messages. An area above that is reserved for messages you display with the MESSAGE statement.

Syntax

MESSAGE 
  [ COLOR color-phrase ] 
  { expression | SKIP [ ( n ) ] } ...  
  [ VIEW-AS ALERT-BOX 
      [ alert-type ] 
      [ BUTTONS button-set ]  
      [ TITLE title-string ] 
  ] 
  [ { SET | UPDATE } field 
        { AS datatype | LIKE field }  
        [ FORMAT string ] 
        [ AUTO-RETURN ] 
  ] 
  [ IN WINDOW window ] 

COLOR color-phrase
expression
SKIP [ ( n ) ]
VIEW-AS ALERT-BOX [ alert-type ]
BUTTONS button-set
TITLE title-string
SET field
UPDATE field
AS datatype
LIKE field
FORMAT string
AUTO-RETURN
IN WINDOW window
Examples

In 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 SalesRep of the Customer.

r-msg.p
REPEAT: 
  PROMPT-FOR Customer.CustNum. 
  FIND Customer USING Customer.CustNum NO-ERROR. 
  IF NOT AVAILABLE Customer THEN DO: 
    MESSAGE "Customer with CustNum " INPUT Customer.CustNum 
      " does not exist.  Please try another". 
    UNDO, RETRY. 
  END. 
  ELSE 
    DISPLAY Customer.Name Customer.SalesRep. 
END. 

The following example uses two alert boxes:

r-altbox.p
DEFINE VARIABLE cust-list AS CHARACTER NO-UNDO 
  VIEW-AS SELECTION-LIST SINGLE SIZE 50 BY 10 LABEL "Customers". 
DEFINE VARIABLE ok-status AS LOGICAL   NO-UNDO 
FORM cust-list 
  WITH FRAME sel-frame. 
ON DEFAULT-ACTION OF cust-list DO: 
  MESSAGE "You have chosen to delete" cust-list:SCREEN-VALUE + "." SKIP(1) 
    "Do you really want to delete this customer?" 
    VIEW-AS ALERT-BOX QUESTION BUTTONS YES-NO-CANCEL 
    TITLE "" UPDATE lChoice AS LOGICAL. 
  CASE lChoice: 
    WHEN TRUE THEN /* Yes */ DO: 
      FIND Customer WHERE Customer.Name = cust-list:SCREEN-VALUE 
        EXCLUSIVE-LOCK. 
      DELETE Customer. 
    END. 
    WHEN FALSE THEN /* No */ DO: 
      MESSAGE "Deletion canceled." 
        VIEW-AS ALERT-BOX INFORMATION BUTTONS OK. 
      RETURN NO-APPLY. 
    END. 
    OTHERWISE /* Cancel */ STOP. 
  END CASE. 
END. 
FOR EACH Customer NO-LOCK BY Customer.Name: 
  ok-status = cust-list:ADD-LAST(Customer.Name). 
END.  
ENABLE cust-list WITH FRAME sel-frame. 
WAIT-FOR WINDOW-CLOSE OF CURRENT-WINDOW.                 

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
See also

COLOR phrase, DECIMAL function, Format phrase, INTEGER function, MESSAGE-LINES function, STRING function


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex