On Friday, September 30, 2022 at 3:14:40 PM UTC+1, Rich wrote:
> GeorgeB <
george.b...@gmail.com> wrote:
> > On Friday, September 30, 2022 at 3:47:23 AM UTC+1, Rich wrote:
> >> GeorgeB <
george.b...@gmail.com> wrote:
> >> > I seem to get error invalid command name "lremove"
> >> What version of Tcl are you using?
> >
> > @saitology9, thanks that got rid of the error message but the bandings seem to have disappeared.
> >
> > @Rich, using TCL 8.6.9
> Ok, that explains why you saw no lremove, lremove was added in of 8.7.
>
> Note, it is better to reply to each message, not "group replies" into a
> single one. Most of us here are not using that absolutely awful google
> groups interface, and doing "group replies" breaks the message
> threading for everyone else.
Ahh, understood.
Btw in my earlier message I mentioned that banding i.e. highlighted row upon selection seemed to have disappeared. That does happen but only when I run the code with other parts of my GUI application.
If I run the code (shown below) in a fresh clean script and run it from command line....all is good.
So, where would I start looking if I had to debug. I think "$tw selection set $sel" is not being set hence I can not see selection on screen but if I print $sel to console, then it shows the items that I have clicked on the tree.
package req Tk
image create photo ::img::cb(0) -data {
R0lGODlhDwAPANUAANnZ2Y6Pj/T09K6zua+0urS5vbu+wcvP1dDT2NXY3Nvd38HDxc3R1tLV2tjb
3t3f4eLj5MbHyM3R19DU2dTX2+Hi4+Xm5ujo6MzNzbK3vNrc3+Dh4+zs7O3t7dTV1ri7v+Tl5erq
6u/v7/Ly8tzd3ry/wuPk5enp6fX19eHi4sLExvDw8Pb29ubm5srLzNTU1dvb3ODh4ebn5+rr6+vs
7Ovr7Onp6v///////////////////////////////////yH5BAEAAAAALAAAAAAPAA8AAAZvQIBw
SCwCAsikMikMCJ7QqCDQFAyuWELBMK0ODuADIqFYdI9WMKPheEAiZ+dAMqEoKpYLJi7IJDQbFxwd
HR58Hw8gISIjjSR8JSYnHSMCKAIpfCqTKwIsny18Li8wMTIzNDU2fFJSVEdLsa9GtABBADs=}
image create photo ::img::cb(1) -data {
# -image ::img::cb(0)]
## put this bind inside display_tree with the other bind
bind $tw.tree <ButtonRelease-1> {manage_sel %W}
#bind $tw.tree <Button-1> {manage_sel %W}
# ## Arrange the tree and its scrollbars in the toplevel
lower [ttk::frame $tw.dummy]
pack $tw.dummy -fill both -expand 1
grid $tw.tree $tw.vsb -sticky nsew -in $tw.dummy
grid $tw.hsb -sticky nsew -in $tw.dummy
grid columnconfigure $tw.dummy 0 -weight 1
grid rowconfigure $tw.dummy 0 -weight 1
}
proc manage_sel {tw} {
set sel [$tw item {} -values]
set new [$tw focus]
#set img 0
if {$new eq ""} {
return
} elseif {[$tw set $new type] ne "file"} {
set sel [lremove $sel $new]
#set img 0
} elseif {$new in $sel} {
#set img 1
set sel [lremove $sel $new]
} else {
lappend sel $new
#set img 1
}
$tw item {} -values $sel
# try and change checkbutton image
#$tw item {} -values $sel -image ::img::cb($img)
#$tw item {} -image ::img::cb($img)
$tw selection set {}
$tw selection set $sel
}