Access to Parameters defined in a GUI
Hey guys,
I've got the following tcl code:
hwt::CreateWindow lala \ -windowtitle 'title' \ -noGeometrySaving \ -cancelButton Cancel \ -acceptButton Okey \ -acceptFunc applyFunction \ -defaultButton Accept \ -minsize 470 100 \ -post; set recess [::hwt::WindowRecess lala]; set section2 [label $recess.section2 \ -text 'entry: ' \ -justify left \ -anchor nw \ -font [hwt::AppFont]]; pack $section2 -side top -anchor nw -pady 5; hwt::AddPadding $recess -side top -height [hwt::DluHeight 4]; set valueToPrint [ AddEntry $recess.frame2 label 'value:' labelWidth 40 entryWidth 20 anchor nw validate real text 200 withoutPacking]; pack $valueToPrint -side top -anchor nw -pady 5; AddPadding $recess.frame2 width 22 -side left; EntryInsert $valueToPrint 7000; proc applyFunction {args} { tk_messageBox -message 'I don't know how to print the value :-('; }
Now, I'd like to print the Value 'valueToPrint'.
I tried
puts $valueToPrint, but it doesn't work. How can I get access to the parameter defined in the GUI?
Thanks for your help.
Mike
Answers
-
Hi,
look like you a refer to global variable, please try 'puts $::valueToPrint'
0 -
Altair Forum User said:
Hi,
look like you a refer to global variable, please try 'puts $::valueToPrint'
Thanks tinh, but it doesn't work. Other ideas? Have you tried it? Does is work for you?
Cheers, Mike
0 -
Hi,
How's about the result?
what do you want to print?
0 -
-
I copy your code and paste to command window, and then i type: puts $valueToPrint
it returns .lala.topFrame.recess.frame2
Do you want to return '7000' instead?
If so, give the entry a textvariable
set EntryWidget [ AddEntry $recess.frame2 textvariable valueToPrint label 'value:' labelWidth 40 entryWidth 20 anchor nw validate real text 200 withoutPacking];
pack $EntryWidget -side top -anchor nw -pady 5;
AddPadding $recess.frame2 width 22 -side left;
EntryInsert $EntryWidget 7000; #or set valueToPrint 7000proc applyFunction args {tk_messageBox -message $::valueToPrint}
0 -
A late reply, but: THANK YOU!!
that was what I was looking for. You are awesome Tinh!
0 -
Привет товарищи!
Предлагаем Вашему вниманию изделия из стекла для дома и офиса.Наша организация ООО «СТЕКЛОЭЛИТ» работает 10 лет на рынке этой продукции в Беларуси.
Более подробная информация размещена https://drive.google.com/file/d/1M3yBV_X6avVPgF2FyJhEy5k9Xdyq9NUo/view?usp=sharing
Увидимся!0 -
Добрый день товарищи!
Наша компания занимается свыше 10 лет продажей промышленных и фасадных красок в городе Минске.Основные направления и виды нашей деятельности:
https://drive.google.com/file/d/1Rjn-phsZoQftAlG7KZHhbxRAHyVUWC20/view?usp=sharing
Всегда рады помочь Вам! С уважением, BELYJMOST
http://www.badrgate.com/vb/member.php?u=23450
http://support.annke.com/forum/space-uid-31876.html
http://www.bojanas.info/sixtyone/forum/upload/member.php?u=1162477
http://dq.dianchu.net/home.php?mod=space&uid=227677
http://thetherapistdirectory.net/author/zelenafra/0