Manipulating Existing Commands
Functions Introduced:
The function
ProCmdCmdIdFind() allows you to find the command ID for an existing command so you can add an access function or bracket function to the command. You must know the name of the command in order to find its ID. See section
Using the Trail File to Determine UI Names to determine UI names in order to determine the name of the command.
The functions
ProCmdAccessFuncAdd() and
ProCmdAccessFuncRemove() allow you to impose an access function on a particular command. (See function
ProCmdActionAdd() for a description of access functions.) The Add function provides an
access_id. This
ID must be saved for later use when you deactivate the access function.
The function
ProCmdBracketFuncAdd() allows the creation of a function that will be called immediately before and after execution of a given command. This function would be used to add company logic to the start or end (or both) of an existing command. It could also be used to cancel an upcoming command. This function is declared as:
ProError ProCmdBracketFuncAdd (
uiCmdCmdId cmd_id,
uiCmdCmdBktFn bracket_func,
char *bracket_func_name,
void **pp_bracket_data );
The function takes the following arguments:
• cmd_id—The command identifier.
• bracket_func—The callback function to be called before and after the command, cast to a uiCmdCmdBktFn:
typedef int (*uiCmdCmdBktFn)
( uiCmdCmdId command,
uiCmdValue *p_new_value,
int entering_command,
void **pp_bracket_data);
The entering command argument will be 1 before execution and 0 after. If the operation is before the upcoming command execution, and you want to cancel the upcoming command execution, return 0. Otherwise, return non-zero.
• bracket_func_name—The name of the bracket function.
• pp_bracket_data—A void** containing data to be passed to the bracket function.
|
Note:
|
Model tree commands that use the model tree action functions cannot be used as bracket functions. Such commands exit before the redefinition starts. You can use the notification function ProNotificationSet() to get and set the notifications for the pre and post redefinition callbacks, respectively. You need to set the value of the enumerated data type ProNotifyType to PRO_FEATURE_REDEFINE_PRE or PRO_FEATURE_REDEFINE_POST.
|
Parent topic