Trigger_RegisterFormByName()

Examples


The Trigger_RegisterFormByName() function registers a form trigger for a form in the specified dictionary. When a form trigger is registered, an “Extras” menu will appear when the specified form is opened.

Syntax

Trigger_RegisterFormByName(product_ID, form_name, menu_item_name, accelerator_key, script processing_procedure {, tag})

Parameters

product_ID – An integer specifying the ID of the product that contains the form for which the trigger is being registered.

form_name – A string containing the name of the form for which the trigger is registered. The Extras menu will appear when this form is open.

menu_item_name – A string containing 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 the 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.

Return value

An integer corresponding to the following constants:

[spacer]

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.

SY_INVALID_OBJECT

4

The object for which the trigger is being registered cannot be found.


Comments

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.


Documentation Feedback