TK GUI TUTORIAL
Hello, I am going thorugh the tutorial for the HW GUI TOOLKIT and I got stock when running it.
The example is as follows:
#
#
#
hwt::CreateWindow mytoplevel \
-windowtitle 'Dialog Title'\
-noGeometrySaving \
-cancelButton Cancel \
-acceptButton OK \
-acceptFunc applyFXN \
-defaultButton Accept \
-minsize 470 300 \
-post;
proc applyFXN {args } {
tk_messageBox -message 'The Createwindow function passes the \
toplevel window to the procedure listed so you must have args \
in the procedure. Args is $args';
destroy $args;
}
set recess [hwt::WindowRecess mytoplevel];
set section1 [label $recess.section1 \
-text 'Section one label '\
-justify left \
-anchor nw \
-font [hwt::AppFont]];
pack $section1 -side top -anchor nw;
hwt::AddPadding $recess -side top -height [hwt::DluHeight 4];
set frame1 [frame $recess.frame1];
pack $frame1 -side top -anchor nw;
hwt::AddPadding $frame1 -side left -width [hwt::DluWidth 4];
set fileSelection [ hwt::AddEntry $frame1.entry1 \
-label 'File Name' \
-labelWidth 15\
-entryWidth 42\
-listProc whenPressed 'dialogBrowse $recess' \
-iconName msfolder \
-iconLoc -1 2 \
-withoutPacking \
-textvariable filename \
-state 'normal' ];
proc dialogBrowse {args} {
variable filename
variable recess
set filename [tk_getOpenFile -parent $recess]
}
pack $fileSelection -side left -anchor nw;hwt::AddPadding $frame1 -side left -width [hwt::DluWidth 4];
set bWidth [hwt::DluWidth 50 [hwt::AppFont]];
set bHeight [hwt::DluHeight 14 [hwt::AppFont]];
set button1 [hwt::CanvasButton $frame1.button $bWidth $bHeight \
-command '[namespace current]::importFile' $recess \
-text import \
-state normal \
-takefocus 1\
-font [hwt::AppFont]];
proc importFile {args} {
tk_messageBox -title 'GUI Checklist' \
-message 'The file has been imported.' \
-icon info \
-parent $args \
-type ok;
}
pack $button1 -side left -anchor nw;
#
#
It is a very simple code that displays a window with a input box to select a file.
I get an error message when running it that says there is no such variable as recess.
Does anybody know where to look for the syntax of the getOpenFile command?
Thanks!