Menu Item Callbacks

Description

Callback function fired when a user clicks a menu item.

Menu item callbacks are added to a menu item with AddCallbackItem.

Use this callback to define a special function that will execute when the user activates the associated callback menu item. For example, you could implement a function that modifies the current layout or changes some user preferences.

This differs from a command menu item associated to a custom command that you have defined in the same plug-in in that a callback function does not get added to the Softimage command map.

 

This callback is fired every time the menu callback function is invoked.

Applies To

Menu items added to a menu item with AddCallbackItem.

Syntax

// C#
public class <menu_name>
{
   public bool <menu-item_callback_name>( Context in_ctxt )
   {
       ...
   }
}

 

// C++
CStatus <menu-item_callback_name>( CRef& context )
{
   ...
}

// JScript
function <menu-item_callback_name>( context )
{
   ...
}

' VBScript
Function <menu-item_callback_name>( context )
   ...
End Function

# Python
def <menu-item_callback_name>( context ):
   ...

# PerlScript
sub <menu-item_callback_name> 
{
   my $context = shift;
}

<menu-item_callback_name> is the name specified in the call to AddCallbackItem, with any spaces removed.

 

Parameters

Parameter

Language

Type

Description

in_context

Scripting and C#

Context

Context.Source returns the MenuItem.

For context menus, the Target context attribute specifies the selected objects, or the object under the mouse.

C++

CRef &

A reference to the Context object.

Context Attributes

For most context menus, the Target attribute contains the selected objects and the object under the mouse pointer.

For regular menus (except for the File menu in the Plug-in Manager), the Target attribute is not set).

Attribute

Menus

Description

Target

3D View and SE context menus

Scripting
XSICollection containing the selected objects and the object under the cursor.

C++
CValue containing a CValueArray. The array contains the selected objects and the object under the cursor.

Property Editor context menu

The object whose parameters are displayed on the property page (for example, a KinematicState object for the Global Transform property page).

Plug-in Manager and menus (context and normal menus)

Workgroup Manager File menu

The View object for the Plug-in Manager.

Script Editor context menus

History pane The selected text or, if no text is selected, the current line.

Editing pane The View object for the script editor.

See Also

Init (Menu)

Menu Callbacks

Standard and Contextual Menus



Autodesk Softimage v7.5