add_menucb
The add_menucb command creates a checkbox within the specified menu of the specified window. A checkbox is a small box with a label. Clicking on the box will toggle the state, from on to off or the reverse. When the box is "on", the Tcl global variable <var> is set to <onval>. When the box is "off", the global variable is set to <offval>. Also, if something else changes the global variable, its current state is reflected in the state of the checkbox. Returns nothing.
Syntax
add_menucb
<window_name>
<menu_name>
<Text>
-variable <var>
-onvalue <onval>
offvalue <offval>
[
-indicatoron <val>]
Arguments
<window_name>
Tk path of the window containing the menu. Required.
<menu_name>
Name of the Tk menu widget. Required.
<Text>
Text to be displayed next to the checkbox. Required.
-variable <var>
Global Tcl variable to be reflected and changed. Required.
-onvalue <onval>
Value to set the global Tcl variable to when the box is "on". Required.
offvalue <offval>
Value to set the global Tcl variable to when the box is "off". Required.
-indicatoron <val>
0 or 1. If 1, the status indicator is displayed. Otherwise it is not displayed. Optional. The default is 1.
Examples
add_menucb $wname mine.vars "Feature One" -variable myglobalvar($wname:one) \ -onvalue 1 -offvalue 0 -indicatoron 1See also
add_menu, add_menuitem, add_separator, add_submenu, change_menu_cmd
Model Technology Incorporated Voice: (503) 641-1340 Fax: (503)526-5410 www.model.com sales@model.com |