*ContextMenuItem()
Right-click on an entity to create a new, user-defined コンテキストメニュー item that launches a Tcl procedure.
Syntax
*ContextMenuItem (var_name, label, path to the TCL script file, TCL procedure, entity type)
Application
HyperGraph.
Inputs
- var_name
- The variable name of the menu item.
- label
- The label displayed in the right-click, コンテキストメニュー.
- 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.
- entity type
- Entity to which the menu is associated. Possible values for the plot window
include:
- Plot
- Axis
- Curve
- Datum
- Legend
- Note
- Title
Context
*BeginDefaults()
*BeginPlotDefaults()
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
}