IsEventContext function
Description
Determines if the currently executing Basic+ code is being run in response to an event originating from the Presentation Server.
Syntax
IsEvent = IsEventContext()
Parameters
N/A
Returns
Returns TRUE$ (1) if the currently executing code is being called in response to an event, or FALSE$ (0) otherwise.
Errors
N/A
Remarks
Basic+ code can be executed from a variety of sources outside of the Presentation Server, such as from a web-server via OECGI, from a .NET client app via NetOI and so on, i.e. they can be executed in a different context.
When sharing code that is called from these different sources it is sometimes necessary to know this context so that the programs behave appropriately, because some functions, like Msg(), will only operate properly when called from the Presentation server. The IsEventContext function can be used to determine this an protect context-sensitive code sections.
Example
Declare Function IsEventContext $Insert Logical If IsEventContext() Then * // Use the Msg() function to display an error message Call Msg( @Window, ErrorText ) End Else * // report the error via other means End