ddRegTrigger
ddRegTrigger(t_triggerName s_triggerFunc[x_priority] ) => t / nil
Description
Registers a function to be called when the triggering event occurs. Adds callbacks (triggers) to PI functions that change things. Each of these PI functions has a pre-trigger and an post-trigger.
Functions you attach to a pre-trigger are passed the same arguments that were passed to the associated PI function. Functions you attach to a pre-trigger should be written to return either t or nil. If the value is nil, no further trigger functions are called, and the associated PI function will be canceled.
Functions that you attach to a post-trigger will be passed the same arguments that were passed to the associated PI function, and in addition, the last argument will be the value to be returned by the PI function. Post-trigger functions must be written to return void.
Arguments
| Valid Values: | ||
|---|---|---|
| PI function | Pre-Trigger name | Post-Trigger name |
Value Returned
|
The function was successfully registered to trigger when the event occurs. |
|
Examples
ddRegTrigger( "PreCheckin" ’checkinTrigFunc 0 )
=> t
Additional Information
Application programs need to react when certain changes occur to library objects. The DFII software lets you register a SKILL function to be called (triggered) when certain changes either have just occurred or are about to occur for library objects.
Use the registration function, ddRegTrigger, to register a function to be called for any kind of triggering event.
For example, to register the function exampleCheckinCallback to be called when any cellview version is checked in,
ddRegTrigger( "PostCheckin" ’exampleCheckinCallback )
You can register many functions to be called when an event occurs. When several functions are registered for the same event, you can set the order called using the priority argument of ddRegTrigger. Triggers that have lower priorities are called back before triggers that have higher priorities. Each function registered for a single triggering event must have a unique name. If you try to register a function with the same name as one already registered, the registration function returns nil and the original function remains registered.
Having unnecessary functions registered can slow down performance. Un-register functions that are no longer needed. The ddUnregTrigger function un-registers a trigger.
A trigger that calls registered functions before the object is changed is called a pre-trigger. A trigger that calls the registered functions after the object is changed is called a post-trigger.
Pre-triggers are created to prepare information or the user environment and are allowed to cause the function to fail, preventing execution of the body of the function. Post-triggers may not cause the function to fail and are expected to handle cleanup of user data or other bookkeeping tasks.
Functions you attach to a pre-trigger are passed the same arguments passed to the associated PI function. Functions that you attach to a pre-trigger should be written to return either t or nil. If the value is nil, no further trigger functions are called and the associated PI function is canceled.
Functions you attach to a post-trigger are passed the same arguments passed to the associated PI function. In addition, the last argument is the value returned by the PI function. Post-trigger returns are ignored with the exception of the First Access Lib Trigger, which must return t or nil.
Return to top