Right click on an entity to create a new, user-defined context sensitive menu item that launches a TCL procedure.
Syntax |
*ContextMenuItem(var_name, label, path to the TCL script file, TCL procedure, entity type) |
|||||||||||||||
Argument |
Name |
Description |
||||||||||||||
var_name |
The variable name of the menu item. |
|||||||||||||||
label |
The label displayed in the right click, context sensitive menu. |
|||||||||||||||
path to the TCL script file |
Path to the TCL script that gets sourced when the menu item is selected. |
|||||||||||||||
TCL procedure |
TCL procedure that is executed when a menu item is selected. Five arguments are passed to this procedure. These are only available when you are in the plot window:
Each of these arguments is one-based. For Point Number, the value is 0 unless you pick Curve for the entity type argument. |
|||||||||||||||
entity type |
Entity to which the menu is associated. Possible values for the plot window include:
An additional value, animation, is available when you are in the animation window. |
|||||||||||||||
Example |
*BeginDefaults() *BeginPlotDefaults() *ContextMenuItem(varname, "Run Script", context_menu.tcl, Main, axis) *ContextMenuItem(varname, "Apply window styles...", {getenv("ALTAIR_HOME") + "/utility/scripts/stylesheets.tcl"}, ::plot::StyleSheet::PostWindow, plot *EndPlotDefaults() *EndDefaults()
Please also refer to the following context_menu.tcl example: proc proc2 {args} { #puts $args hwi OpenStack hwi GetSessionHandle sess sess GetProjectHandle proj proj GetPageHandle page [lindex $args 0] page GetWindowHandle wind [lindex $args 1] wind GetClientHandle plot plot SetBackgroundColor 4 plot Draw hwi CloseStack } proc proc1 {args} { puts $args hwi OpenStack hwi GetSessionHandle sess sess GetProjectHandle proj proj GetPageHandle page [lindex $args 0] page GetWindowHandle wind [lindex $args 1] wind GetClientHandle plot #puts [plot GetBackgroundColor] plot GetCurveHandle curve [lindex $args 3] #puts [curve GetLineColor] curve SetLineColor 9 plot Draw hwi CloseStack } |
|||||||||||||||
Application |
HyperGraph. |
|||||||||||||||
Context |
||||||||||||||||
See also |
|
|||||||||||||||