The Trigger_RegisterForm() function registers a form trigger for use with the runtime engine. When a form trigger is registered, an “Extras” menu will appear when the specified form is opened.
Trigger_RegisterForm(form form_name, menu_item_name, accelerator_key, script processing_procedure {, tag})
• form form_name – The name of the form for which the trigger is registered. The Extras menu will appear when this form is open.
• menu_item_name – The name of the menu item as it will appear in the Extras menu.
• accelerator_key – The accelerator key used with the menu_item_name. This is the key that, when used with the control key, chooses menu_item_name. For instance, specifying “1” will enable an accelerator key of ctrl+1 for a Windows application. Be sure that this key doesn’t conflict with any existing accelerator keys. If you don’t want an accelerator key, indicate an empty string ("").
• script processing_procedure – The procedure you write that will run when you choose the menu_item_name from the Extras menu.
• tag – An optional returned integer that uniquely identifies the trigger. This value is used when you want to unregister, enable or disable the trigger individually.
An integer corresponding to the following constants:
Constant |
Value |
Description |
---|---|---|
SY_NOERR |
0 |
No error occurred. |
SY_UNKNOWN |
1 |
An unknown error occurred and the trigger was not registered. |
SY_INVALID_SCRIPT |
2 |
The trigger processing script was either not found or had the wrong number of parameters. The trigger was not registered. |
You can disable all triggers for a given application using the Trigger_Enable() function or the Customization Status window. If you disable a form trigger for a form that’s currently open, the Extras menu won’t disappear until the form is closed. If the user chooses the menu item before closing the form, the message “Cannot run form trigger” will appear.