Function SetAppEvent() Foundation
Associates a code block with an event.
SetAppEvent( <nEvent>, [<bNewBlock>] ) --> bOldBlock
If SetAppEvent() is called without the argument <bNewBlock>, the function returns the code block currently linked to the event. If the event with the code <nEvent> is not currently linked to a code block, NIL is returned. If <bNewBlock> is specified, the new code block is attached to the event and the old code block or NIL is returned.
The function SetAppEvent() associates a code block with a specific event or returns the code block currently associated with the event. The code block is then automatically executed by certain functions and commands which independently process events. These include input commands like ACCEPT and READ as well as the dialog functions like MemoEdit(). If code blocks are associated with the same key using SetKey() and SetAppEvent(), both code blocks are automatically executed one at a time.
Most functions or commands do not provide automatic event processing. In this case a code block which is associated with an event must be retrieved with SetAppEvent() and evaluated with Eval().
Suppressing default event handling in text-mode functions
The return value of the SetAppEvent() code block influences the default event handling of all functions and commands that evaluate this code block automatically on their own. This applies only to text-mode commands and functions such as Achoice() or Memoedit(). If the code block returns 0 or a non-numeric value, the event associated with the code block is not processed further, i.e. a default event processing can be disabled in this way. If the code block returns a valid event code, this event will be processed. This way, a default bahavior for a given event can be mapped to a different behavior.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.