Hi,
I have created three radiobuttons per day for each day of a month using an array using the following code for January, (each month is a tab in a notebook)
set pane [$nb getframe jan]
set mth 1
set i 0
for {set dy 1} {$dy <= 31} {incr dy} {
set ::mark($dy) "$marker($dy)"
set ::dy $dy
if {$::mark($dy) == "Q"} {set mcol "green"}
if {$::mark($dy) == "D"} {set mcol "red"}
if {$::mark($dy) == "N"} {set mcol "black"}
label $pane.jan_lbl_$dy -text "[clock format [clock scan "$dy$year" -format {%j%Y}] -format {%d %b %Y}] \t [format %03.0f $dy] \t" -foreground $mcol
radiobutton $pane.jan_rad_q$dy -text "Q quiet" -variable ::mark($dy) -value "Q" -command {
set mcol "green"
.qdn.nb.fjan.jan_lbl_$dy configure -text "[clock format [clock scan "$dy$year" -format {%j%Y}] -format {%d %b %Y}] \t [format %03.0f $dy] \t" -foreground $mcol
} -foreground green
radiobutton $pane.jan_rad_q$dy -text "D disturbed" -variable ::mark($dy) -value "D" -command {
set mcol "red"
.qdn.nb.fjan.jan_lbl_$dy configure -text "[clock format [clock scan "$dy$year" -format {%j%Y}] -format {%d %b %Y}] \t [format %03.0f $dy] \t" -foreground $mcol
} -foreground red
radiobutton $pane.jan_rad_q$dy -text "N normal" -variable ::mark($dy) -value "N" -command {
set mcol "black"
.qdn.nb.fjan.jan_lbl_$dy configure -text "[clock format [clock scan "$dy$year" -format {%j%Y}] -format {%d %b %Y}] \t [format %03.0f $dy] \t" -foreground $mcol
} -foreground black
grid $pane.jan_lbl_$dy -column 0 -row $i
grid $pane.jan_rad_q$dy -column 1 -row $i
grid $pane.jan_rad_d$dy -column 2 -row $i
grid $pane.jan_rad_n$dy -column 3 -row $i
incr i
}
The idea is to select a value for each day as being one of the three options available & colour code the day according to the option selected. However, whichever day I select the only change occurs in the last day. Is there a way to capture the value of $dy according to which radiobutton was selected. $marker($dy) contains values of either Q, D, or N to give initial set which radiobutton should be activated, these values were read from a file containing values for the whole year.
I have been struggling with this for a few days and would really appreciate any help with this.
I have created three radiobuttons per day for each day of a month using an array using the following code for January, (each month is a tab in a notebook)
set pane [$nb getframe jan]
set mth 1
set i 0
for {set dy 1} {$dy <= 31} {incr dy} {
set ::mark($dy) "$marker($dy)"
set ::dy $dy
if {$::mark($dy) == "Q"} {set mcol "green"}
if {$::mark($dy) == "D"} {set mcol "red"}
if {$::mark($dy) == "N"} {set mcol "black"}
label $pane.jan_lbl_$dy -text "[clock format [clock scan "$dy$year" -format {%j%Y}] -format {%d %b %Y}] \t [format %03.0f $dy] \t" -foreground $mcol
radiobutton $pane.jan_rad_q$dy -text "Q quiet" -variable ::mark($dy) -value "Q" -command {
set mcol "green"
.qdn.nb.fjan.jan_lbl_$dy configure -text "[clock format [clock scan "$dy$year" -format {%j%Y}] -format {%d %b %Y}] \t [format %03.0f $dy] \t" -foreground $mcol
} -foreground green
radiobutton $pane.jan_rad_q$dy -text "D disturbed" -variable ::mark($dy) -value "D" -command {
set mcol "red"
.qdn.nb.fjan.jan_lbl_$dy configure -text "[clock format [clock scan "$dy$year" -format {%j%Y}] -format {%d %b %Y}] \t [format %03.0f $dy] \t" -foreground $mcol
} -foreground red
radiobutton $pane.jan_rad_q$dy -text "N normal" -variable ::mark($dy) -value "N" -command {
set mcol "black"
.qdn.nb.fjan.jan_lbl_$dy configure -text "[clock format [clock scan "$dy$year" -format {%j%Y}] -format {%d %b %Y}] \t [format %03.0f $dy] \t" -foreground $mcol
} -foreground black
grid $pane.jan_lbl_$dy -column 0 -row $i
grid $pane.jan_rad_q$dy -column 1 -row $i
grid $pane.jan_rad_d$dy -column 2 -row $i
grid $pane.jan_rad_n$dy -column 3 -row $i
incr i
}
The idea is to select a value for each day as being one of the three options available & colour code the day according to the option selected. However, whichever day I select the only change occurs in the last day. Is there a way to capture the value of $dy according to which radiobutton was selected. $marker($dy) contains values of either Q, D, or N to give initial set which radiobutton should be activated, these values were read from a file containing values for the whole year.
I have been struggling with this for a few days and would really appreciate any help with this.