Communication Messages

From STX Wiki
Jump to navigation Jump to search

Messages are used in STx for many purposes, e.g. for the communication between a shell (command interpreter) and its items (graphs, dialogs, spus etc.) or for the communication and data exchange between shells. Messages are automatically sent to the owning shell by shell items on specific events. Message can also be explicitly sent by the programmer using the MESSAGE command.

STx implements basic message handling using the MESSAGE command. The command MESSAGE LOOP retrieves the earliest message from the queue or waits for a message if none is pending. The message is stored in the variable #MSG in the following format:

#MSG = sendertype sendername messageId messageParameters

In order to be able to use messages, you need to handle them. The STx macro library implements a set of macros to retrieve messages, install and uninstall message handlers and to send messages to other shells. If an application uses message handlers, the macro GetMessage must be used instead of the command Message. The macros are described in the Macro Library reference.

GetMessage retrieves and dispatches messages
SetMsgHandler installs/uninstalls message handlers
PostMessage post a message to a shell

The following section describes the basic shell messages (the format of a message is type name id par) which are returned or dispatched (passed to message handlers) by the macro GetMessage. For a list of messages sent by shell items, please see the individual shell items.

Note that you can break into the debugger using the shortcut combination Ctrl+D Ctrl+D as long as the shell has either a dialog, display or a graph.Note also that if an application is a script, the shortcut Ctrl+B opens the CON window.