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!

Problem fetching text widget value on button click

Status
Not open for further replies.

anirban2k2001

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

I have a tcl text widget with some values in it that has been fetched from a sqlite backend.
I also have a button labelled Submit.
When I click the Submit button, I want to call a procedure which will fetch the value that is stored in the text widget and store it in a variable. What do I write in the procedure?

The procedure which I have written is given below, but it gives me errors while compiling.

The relative code is given below:

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

button .f2.b1 -text "Submit" -command { submit_details } -font $fnt11b
place .f2.b1 -x 2 -y 240 -width 55 -height 20

proc submit_details {} {
puts "Submit"
set seln [.f2.t2 text]
set selcn "[.f2.t2 get $seln]"
puts $selcn
}

Thanking in advance for any help.
Anirban Sarkar


 
Hi Anirban,
i understand You are looking for something like
Code:
proc submit_details {} {
  set submit_data [string trim [f2.t2 get 1.0 end]]
  # do whatever you need with $submit_data
  puts "Submitted Data:" 
  puts $submit_data
}



Tobias Gabele
Bierwirth & Gabele SoftwareDesign GBR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top