button scope problem?
scdtl_at_yahoo.com
Date: 02/27/05
- Previous message: Jeff Hobbs: "Re: starting with tktable"
- Next in thread: Jeff Godfrey: "Re: button scope problem?"
- Reply: Jeff Godfrey: "Re: button scope problem?"
- Reply: Bruce Hartweg: "Re: button scope problem?"
- Reply: Donald Arseneau: "Re: button scope problem?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 Feb 2005 11:30:43 -0800
My first post to this group. I am trying to do something that should be
trivially simple, and it has cost me days of work with no results.
I globally define 2 related arrays, one with names, and with a simple
flag variable, containing 0 or 1. These are passed to a proc, in which
they are 'upvar #0'ed. The proc defines a toplevel, and runs through a
'for' loop, defining checkbuttons and packing them. Each checkbutton
refers to an indexed 'name' array element for the '-text' option and to
an indexed 'flag' array element for the '-variable' option. One
checkbutton is defined outside the loop with "Done" as the text, and a
global variable, which appears in a 'tkwait' statement following the
loop. The proc then destroys the toplevel and exits.
The problem is, the 'flag' array elements are never set by clicking the
checkbuttons. I have tried different approaches to this, assuming that
arrays were the problem, and using named local variables, etc., but
absolutely nothing fixes the problem.
The code per se works. I first placed the code in a standalone Tcl
script for testing, and it worked without a hitch, displaying a list of
named checkbuttons, accepting the checkbutton clicks, and accurately
registering changes in a flag array. Once that code was moved to a
proc, however, all hell broke loose.
The Welch&Jones text indicates that a button variables should be
globally scoped, but I believe that I have addressed that situation, to
no avail.
I am REALLY exasperated with spending so much time on such a trivial
problem, and would appreciate some help with a solution.
- Previous message: Jeff Hobbs: "Re: starting with tktable"
- Next in thread: Jeff Godfrey: "Re: button scope problem?"
- Reply: Jeff Godfrey: "Re: button scope problem?"
- Reply: Bruce Hartweg: "Re: button scope problem?"
- Reply: Donald Arseneau: "Re: button scope problem?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]