Replacing Standard Product Functions
- Last UpdatedOct 30, 2024
- 2 minute read
Product functions written in PML can be replaced by simply changing the callback in a PML Command object. A PMLLIB search path (See Storing and Loading PML Files) can be used to override a standard product PML Command object with a user customized function.
A typical scenario may be to add some validation that is company or project specific to a menu button call, or to replace a standard product function by a company or project specific function.
The first step towards replacing a PML Command object is to find the name of the command object that is linked to the button to be customized. This can be done by using the customization tool to find the key linked to the button, and then search for the PML command that has that key. Alternatively PML tracing functions can be used to find out which command is executed when a button is clicked.
The next step is to take a copy of the command object and add it to a directory in the PMLLIB path.
Then modify PML code in the execute method which is the callback executed when the button is clicked.
If the command being modified has a refresh method then it has some context sensitive behavior. It may initialize itself in some way when the module starts, or it may react to a context message, CE change or other events. It may be necessary to modify code in the refresh method if one has been implemented. The most common use of a refresh method is activation or deactivation a gadget, or to control the visibility of a gadget according to some criteria (e.g. user in a particular team or availability of a given resource such as a particular file). Another common use of refresh methods is to initialize the value of state buttons, combo boxes and other gadgets that have a value property.
Note:
If a button is defined on a tabbed menu by using a direct call to a PML macro, and
not using a command object then the recommended way to customize the callback is to
replace the function that is called with a customized function. The only way to customize
the callback itself is to take a copy of the UIC file containing the button, add it
to a UIC path and replace the callback.
Note:
If the command key referenced by a button cannot be found in the PML commands, then
it is probably a command implemented in the core product.