Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Again Menu

Status
Not open for further replies.

akpr

Programmer
Jul 25, 2001
19
US
Hi
Thanks for helping to solve the menu prob
I have some more problems related to menu.
I could able to set the value .
Now How do i get the value
i.e. I have a menu like

.menu.view.subview.windows add check -label "Output" -variable OPT -command { Output_Click .menu.view.subview.windows Output
}

I want to assess the value for [Variable OPT] from the function [Output_Click] this function will receive 2 parameters one for the id of parent menu and second the label of the child me
Thanks
akpr
 
There should be no problem accessing your checkbutton's state variable. The value of the state variable is toggled before Tcl executes the command associated with the checkbutton. Just keep in mind that the checkbutton's state variable must be a global variable. So, your Output_Click procedure would have to start out as follows:

[tt]proc Output_Click {menu label} {
global OPT
# Now you can use the value of OPT in your procedure
# ...
}[/tt]

By default, the value of a checkbutton's state variable is "1" when it is on, and "0" when it is off. You can override these values by providing -onvalue and -offvalue attributes when you create your checkbutton widget or menu item. For example:

[tt]checkbutton .cb -text "Anchovies" -variable opinion -onvalue yum -offvalue icky

# ...

.mbar.prefs add checkbutton -label "Obfuscate" -variable lang -onvalue "Pig Latin" -offvalue "English"[/tt] - Ken Jones, President
Avia Training and Consulting
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top