* Mark Summerfield <
[email protected]>
| proc test::on_options {} {
| if {![winfo exists .optionsForm]} {
| puts "on_options init"
| toplevel .optionsForm
| set on_close [lambda {} {dialog hide .optionsForm}]
| wm title .optionsForm "Options — [tk appname]"
--<snip-snip>--
I make a habit of putting the layout of any widget structure in
variables, so if I decide to add another frame or toplevel or whatever,
I just need to change the variables and leave the rest of the code
unchanged:
proc test::on_options {} {
set w(optionsForm) .optionsForm
set w(optionsLabel) $w(optionsForm).label
set w(optionsClose) $w(optionsForm).closeButton
if {![winfo exists $w(optionsForm)]} {
puts "on_options init"
toplevel $w(optionsForm)
set on_close [lambda {} [list dialog hide $w(optionsForm)]]
wm title $w(optionsForm) "Options — [tk appname]"
ttk::label $w(optionsLabel) -text "Options go here"
grid $w(optionsLabel) -row 0 -column 0
ttk::button $w(optionsClose) -text Close -command $on_close
grid $w(optionsClose) -row 1 -column 0
...
Say I need the options frame as child of a different widget than ".",
I could just change the proc to
proc test::on_options {top} {
set w(optionsForm) $top.optionsForm
...
and be done.
HTH
R'
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)