saving state via
From: Kevin Ready (kready_at_taec.toshiba.com)
Date: 02/20/04
- Next message: Donal K. Fellows: "Re: Expect if-statement help"
- Previous message: Burn Alting: "Re: Wide int usage"
- Next in thread: StephaneAR: "Re: saving state via"
- Reply: StephaneAR: "Re: saving state via"
- Reply: Kevin Ready: "Re: saving state via"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 19 Feb 2004 15:48:05 -0800
Hello tcl'ers--
I am trying to find a 'best practice' method for saving / loading
widget states in a tcl/tk application. My application will have
several hundred related entry boxes, combo boxes etc., so I am looking
for a way of iterating through my toplevel window's child objects and
saving my application state as an array:
######################################################
### Current unsatisfactory strategy
### SAVE ARRAY BY BRUTE FORCE
######################################################
###SAVE ARRAY
...
array set myGlobals [list {cbSPC0} [Toplevel1 setvar cbSPC0]
{cbSPC1} [Toplevel1 setvar cbSPC1] {cbSPC2} [Toplevel1 setvar cbSPC2]
]###List out all variables in application by hand.
}
...
###LOAD ARRAY
source $filename
foreach id [array names myGlobals] {
Toplevel1 setvar $id $myGlobals($id)
}
######################################################
I found this post, which suggests a method of fetching your windows
children, but I have not been able to get it to work--I always get
"bad window path name" no matter what I pass in to it.
From: Roy Terry (royterry@earthlink.net)
Subject: Re: tcl/tk:saving state of widgets??
Newsgroups: comp.lang.tcl
Date: 2002-02-01 21:31:22 PST
...
proc wfind {{win .}} {
set out $win
foreach w [lsort -dictionary [winfo children $win]] {
lappend out " [wfind $w]"
} return $out
...
Can anybody suggest an alternative method of fetching a list of
widgets and values and saving them?
Kevin Ready
Toshiba America Electronics Components - STI Design Center
Austin, Texas
- Next message: Donal K. Fellows: "Re: Expect if-statement help"
- Previous message: Burn Alting: "Re: Wide int usage"
- Next in thread: StephaneAR: "Re: saving state via"
- Reply: StephaneAR: "Re: saving state via"
- Reply: Kevin Ready: "Re: saving state via"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|