For some reason, the checkbuttons as I have them set up below will not toggle the value of the variables assigned to them when checked/unchecked. Whats odd is this exact same code works in a different procedure but not this one, the variables keep and retain whatever the initial state of the checkbutton is set to. I tried adding and deleting global declarations for these variables but no change. These are contained in a procedure, $read2 $write2 and $exe2 are set up as either r,w,x, or "-" within the proc. I cut out some of the stuff going on inside the procedure here just to explain it simpler. In other words, if it reads $read2 as "r", then the "read" checkbutton lights up, but the variable i_read is now stuck on "r" and won't go back to "-", even if I uncheck it. What gives?
proc save_acl {file user} {
checkbutton $w.c1 -text "Read " -relief sunken -variable i_read -onvalue r -offvalue -
checkbutton $w.c2 -text "Write " -relief sunken -variable i_write -onvalue w -offvalue -
checkbutton $w.c3 -text "Execute" -relief sunken -variable i_exe -onvalue x -offvalue -
if {$read2=="r"} {
$w.c1 select}
if {$write2=="w"} {
$w.c2 select}
if {$exe2=="x"} {
$w.c3 select}
pack $w.c1 $w.c2 $w.c3 -side top
button $w.dismiss2 -text "Cancel" -command {destroy .single}
button $w.accept2 -text "Save changes" -command {save_acl2 $user $file $i_read $i_write $i_exe}
bind $w.accept2 <Return> {save_acl2 $user $file $i_read $i_write $i_exe}
bind $w.dismiss2 <Return> {destroy .single}
pack $w.dismiss2 $w.accept2 -side bottom -anchor s
}
proc save_acl {file user} {
checkbutton $w.c1 -text "Read " -relief sunken -variable i_read -onvalue r -offvalue -
checkbutton $w.c2 -text "Write " -relief sunken -variable i_write -onvalue w -offvalue -
checkbutton $w.c3 -text "Execute" -relief sunken -variable i_exe -onvalue x -offvalue -
if {$read2=="r"} {
$w.c1 select}
if {$write2=="w"} {
$w.c2 select}
if {$exe2=="x"} {
$w.c3 select}
pack $w.c1 $w.c2 $w.c3 -side top
button $w.dismiss2 -text "Cancel" -command {destroy .single}
button $w.accept2 -text "Save changes" -command {save_acl2 $user $file $i_read $i_write $i_exe}
bind $w.accept2 <Return> {save_acl2 $user $file $i_read $i_write $i_exe}
bind $w.dismiss2 <Return> {destroy .single}
pack $w.dismiss2 $w.accept2 -side bottom -anchor s
}