Event Callbacks

 
 
 

An event handler is implemented by an OnEvent callback. All OnEvent callbacks have the same signature: they get a Context or Context object as an argument, and return true or false.

C++ Example: OnEvent Callback

XSIPLUGINCALLBACK CStatus <event_name>_OnEvent( CRef& in_ctxt )
{
	Context ctxt( in_ctxt );

	// 	Your code goes here ...

	// 	Return false to perform the operation, true to abort
	return false;
}

C# Example: OnEvent Callback

public class <event_name>
{
   public bool OnEvent( Context in_ctxt )
   {
		// 	Your code goes here ...
	
		// 	Return false to perform the operation, true to abort
		return false;
	}
}

JScript Example: OnEvent Callback

function <event_name>_OnEvent( in_ctxt )
{
	// Your code goes here ...

	// Return false to perform the operation, true to abort
	return false;
}

Python Example: OnEvent Callback

def <event_name>_OnEvent( in_ctxt ):
	# Your code goes here ...

	# Return 0 (false) to perform the operation, 1 (true) to abort
	return 0

VBScript Example: OnEvent Callback

Function <event_name>_OnEvent( in_ctxt )
	' Your code goes here ...

	' Return False to perform the operation, True to abort
	<event_name>_OnEvent = False
End Function

When You Can Abort

For operations such as save, import, and export, the OnEvent return value specifies whether to abort the operation. Return True to abort the operation, and otherwise return False to allow the operation to continue.

You can abort the following events: