guides:programming:programmers_reference_manual:iseventcontext

IsEventContext function

Determines if the currently executing Basic+ code is being run in response to an event originating from the Presentation Server.

IsEvent = IsEventContext()

N/A

Returns TRUE$ (1) if the currently executing code is being called in response to an event, or FALSE$ (0) otherwise.

N/A

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.

 
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
 
 
  • guides/programming/programmers_reference_manual/iseventcontext.txt
  • Last modified: 2023/10/25 10:49
  • by 127.0.0.1