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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hidden text widget

Status
Not open for further replies.

anirban2k2001

Programmer
Aug 25, 2003
27
0
0
IN
Hi all,

I need to store some values in a hidden text widget which is in a frame in tcl so that I can use those values to perform some mathematical operations when I click on the submit button. My problem is that I cannot make a text widget hidden. I am giving below the text widget code which I am using. What more do I need to specify in my code so that the text widget is hidden?

Code:

frame .f2 -width 250 -height 270
pack .f2
pack propagate .f2 0

label .f2.l1 -text "Name" -font $fnt9
place .f2.l1 -x 0 -y 25

text .f2.t1 -bd 1 -highlightbackground black - highlightthickness 1 -font $fnt9
.f2.t1 insert end [string trim $nm]
.f2.t1 configure -state disabled
place .f2.t1 -x 65 -y 25 -width 170 -height 16

In the above code, $nm contains a value which is to be used for a mathematical operation. So .f2.t1 is to be made hidden.

Any help will be appreciated.
Thanks in advance.

Anirban Sarkar




 
To hide a frame, you would use "withdraw": wm withdraw .f2.t1.

However, I don't see why you have to do that. Why not just use a variable that is not displayed?

Bob Rashkin
rrashkin@csc.com
 
Many thanks for your response.

I tried using your code but it gives me the following error:
Error: ".f2.t1" isn't a top-level window

Regarding your query: I need to specify some hidden text widgets because I want to have access to those values when I click on the Submit button and a procedure is invoked.

If I do a puts $varname on f2 after the query, it fetches the value but when I try to access the same variable from the Submit button procedure it does not recognise the variable.

Regards,
Anirban Sarkar
 
That's because the scope is wrong. Put the variables in a "global" statement in your proc. Like:
Code:
proc procName {} {
  global variable1 variable2 ...
}

Bob Rashkin
rrashkin@csc.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top