Skip to content

INSERT_CONTEXT_MENU_ITEM

INSERT_CONTEXT_MENU_ITEM inserts a new (custom) menu item into a context menu.

Syntax

leo-grammar
CC "Application" INSERT_CONTEXT_MENU_ITEM context:Context 
										item:strValue
										[ pos:strValue ] 

Context :	"drawingarea.general" | "drawingarea.mobject" 
			"drawingarea.connector" | "drawingarea.swimlane" 
			"modelingtable" |"explorer.db" | 
			"explorer.windows" | "startpage.thumb" .

#--> RESULT ecode:intValue .
CC "Application" INSERT_CONTEXT_MENU_ITEM context:Context 
										item:strValue
										[ pos:strValue ] 

Context :	"drawingarea.general" | "drawingarea.mobject" 
			"drawingarea.connector" | "drawingarea.swimlane" 
			"modelingtable" |"explorer.db" | 
			"explorer.windows" | "startpage.thumb" .

#--> RESULT ecode:intValue .

Parameters

  • context (strValue) - specifies which context menu shall be modified.
  • item (strValue) - the menu name. If the item shall be placed in a submenu, the parts of the item path are separated by TAB ("\t") characters, e.g. "New\tModelgroup...". A separator can be inserted by using "-" as item name.
  • pos (strValue) - specifies the position(s) of the item (or item path parts). Like at context, TAB characters are used as separators. So pos:"2\t0" means, that for the first part of the item path the insertion shall be made behind the second already existing item, while the new child item shall be inserted at the beginning of the submenu. An empty insert position value means "append". Position values are ignored for already existing superitems.

Returns

  • ecode (intValue) - Contains the error code or is 0 in case of success.
  • errtext (strValue) - contains a textual representation of the ecode

Details

An item position can also be specified relatively to an existing item. You do that by writing the item name with a prefix "<" or ">". For example, "<Cut" means "insert before item 'Cut' ", ">Copy" means "insert after item 'Copy' ".

See Also

REMOVE_CONTEXT_MENU_ITEM

Examples

asc
# Create submenu "Test" with items "One", separator, "Two" 
CC "Application" INSERT_CONTEXT_MENU_ITEM
    context:"drawingarea.general" item:"Test\tOne"
CC "Application" INSERT_CONTEXT_MENU_ITEM
    context:"drawingarea.general" item:"Test\t-"
CC "Application" INSERT_CONTEXT_MENU_ITEM
    context:"drawingarea.general" item:"Test\tTwo"
# Insert "Three" before "Two"
CC "Application" INSERT_CONTEXT_MENU_ITEM
    context:"drawingarea.general" item:"Test\tThree" pos:"\t<Two"
# Create submenu "Test" with items "One", separator, "Two" 
CC "Application" INSERT_CONTEXT_MENU_ITEM
    context:"drawingarea.general" item:"Test\tOne"
CC "Application" INSERT_CONTEXT_MENU_ITEM
    context:"drawingarea.general" item:"Test\t-"
CC "Application" INSERT_CONTEXT_MENU_ITEM
    context:"drawingarea.general" item:"Test\tTwo"
# Insert "Three" before "Two"
CC "Application" INSERT_CONTEXT_MENU_ITEM
    context:"drawingarea.general" item:"Test\tThree" pos:"\t<Two"

Versions and Changes

Available since ADOxx 1.3