Ask Reuben
Difference Between MESSAGE and ERROR
Why does the MESSAGE text remain?
How to make the MESSAGE disappear?
A common misunderstanding is that apart from something to indicate severity, is that MESSAGE and ERROR have the same properties. They differ in when they disappear having displayed their text to the user. With the example code at the end of the article, click Message, Error, then Action. When you click Action (the next user interaction), the Error tile disappears whilst the Message tile remains. Click the Clear Message After 3 button to see the message tile removed programmatically with MESSAGE “” This screenshot is after clicking Message, then Error to make both tiles appear at once.
This difference also manifests itself in the AUI Tree. If you inspect the AUI Tree, For a MESSAGE you will see a Message node with type=Message as a child of the current Window node. For an ERROR you will a Message node with type=Error as a child of the User Interface node. (Yes it is confusing both Node names being ‘Message’ and the Type attribute being used to differentiate )
Other things to note about MESSAGE and ERROR… Code example used for screenshots:
#! askreuben163.4gl
MAIN
MENU ""
BEFORE MENU
CALL ui.Window.getCurrent().setText("Ask Reuben 163")
COMMAND "Message"
MESSAGE "Message " || CURRENT HOUR TO SECOND
COMMAND "Error"
ERROR "Error " || CURRENT HOUR TO SECOND
COMMAND "Action"
COMMAND "Clear Message After 3"
MESSAGE "3"
CALL ui.Interface.refresh()
SLEEP 1
MESSAGE "2"
CALL ui.Interface.refresh()
SLEEP 1
MESSAGE "1"
CALL ui.Interface.refresh()
SLEEP 1
MESSAGE "" -- clear message
COMMAND "Exit"
EXIT MENU
END MENU
END MAIN