Events are procedures that are called to indicate that something has happened and the plug-in can react on this events.
Events are always fired one after another in the order listed below, but Plugin_CheckData and Plugin_Apply might be fired several times.
Plugin_Initialize
Fired when the plug-in is about to be loaded. You can use this event to read the settings of your plug-in and set the the correct values in the user interface (UI) using the SetUIElement function.
Plugin_CheckData(ElementIndex)
Used to check the data the user has entered in the UI. You can retrieve an item with the GetUIElement function and, if the value entered is not correct, declare it as not valid with the DataInvalid function.
Note that this event will not be fired if the user doesn't change anything. For example, if your plug-in is loaded and the user clicks the Apply without changing anything in the UI your plug-in will not receive the CheckData event.
The parameter ElementIndex contains the index of the changed element, where the first element has the index of one.
Plugin_Apply(ElementIndex,ElementSubIndex)
Fired when the plug-in should perform its changes to the system. It is generated if the user clicks the "Apply Changes" button or when a button inside the plug-in UI is clicked (type is listbox or buttons).
This is the only event where the plug-in is allowed to perform changes to the system (see the Function Reference for more information).
The parameter ElementIndex normally contains zero except the plug-in contains buttons (for example if type is listbox) where it contains the index of the button the user has selected.
The parameter ElementSubIndex normally contains zero except if the type of the plug-in is listbox where it contains the index of the selected item (set using the SetUIElement function) inside the listbox. If the type of the plug-in is listbox but the user hasn't selected an item it also conatins zero.
Plugin_Terminate
Fired when the plug-in is about to be removed from memory (unloaded). The plug-in does not need to clean up anything or re-set any UI elements, this is all done automatically by X-Setup. Anyway, the developer might find this event useful for something that should be done before the plug-in is finally terminated.