Description

Returns true if the code is executing in an event context.

Syntax

truefalse = IsEventContext ()

Remarks

When an event occurs, the associated code is executed. That code, and any functions or subroutines called by that code, is being executed in an event context. Code executed from the command line in the System Editor or via the OpenEngine C interface is not executed in event context. Some functions, like Send_Event, must be executed in an event context or an error will occur. To test for event context, call IsEventContext and test the return value.

Returns

True if the code is executing within event context.

Example

subroutine TestEventContext(void)
declare function   IsEventContext
declare subroutine Message_Box, MessageBox
$insert Message_Box_Equates
if IsEventContext() then
  Text  = "Run from an event or the system monitor"
  Title = "TestEventContext"
  Message_Box(@window, Text, Title, MSG_ICON_INFO$)
end else
  Text  = "Run from the System Editor": \00\
  Title = "TestEventContext": \00\
  MessageBox(0, Text, Title, MSG_ICON_INFO$)
end
return
  • No labels