subMenu

A subMenu is used to place an item in the right-click menu that, if the cursor is placed on, opens a submenu containing additional user-interface items. The syntax for a subMenu is:

subMenu <label> [ filter:<function> ] ( <submenu_body> )

The <submenu_body> of a subMenu definition is made up of a sequence of RCMenu clauses as follows:

<submenu_body> ::= { <rcmenu_clause> }+

Parameters

label:

The string that appears in the right-click menu.

filter:

A function that returns a Boolean value. The filter function is evaluated when the right-click menu is first opened. If the filter function returns true the subMenu appears in the menu, otherwise it is not displayed.

Example:

rcmenu MyRCmenu

(

fn flt_objects = ($ != undefined) -- objects filter

fn flt_shapes = (isKindOf $ Shape) -- shapes filter

menuItem mi_cs "Cast Shadows" checked:false

menuItem mi_rs "Receive Shadows" checked:false

separator sep2 filter:flt_objects

subMenu "Modifiers" filter:flt_objects -- begin subMenu

(

-- Add common objects

menuItem mi_bend "Bend"

menuItem mi_twist "Twist"

-- Add shape only modifiers

separator sep3 filter:flt_shapes

subMenu "Shape" filter:flt_shapes -- begin nested subMenu

(

menuItem mi_extrude "Extrude"

menuItem mi_EditSpline "Edit Spline"

)

)

-- event handlers would go here...

)

registerRightClickMenu MyRcmenu -- register the rcmenu

See also

RCMenu Clauses

Scripted Right-Click Menus