Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

tablelist row background issues?

1 view
Skip to first unread message

ben bitdiddle

unread,
Aug 13, 2003, 1:45:49 AM8/13/03
to
Hi. I'm working with multiple tablelists in a small demo. I'd like to be
able to click on a row in one tablelist and have rows in another tablelist
satisfying some criteria described by the earlier selection, be
highlighted. I'd also like the highlighting to clear when a row is no
longer highlighted. Therein lies the problem- I can't restore the original
color of the rows, my attempt at this is below. Any insight?
-BB

proc highlight_products {input {col 1}} {
746 puts "within $input \n"
747
748 for {set i 0} {$i < [$::prodTbl index end]} {incr i} {
749 if {[info exists ::originalBg($i)]} {
750 puts "originalBg exists, setting row back to original color\n"
751 $::prodTbl rowconfigure $i -background ::originalBg($i)
752 } else {
753 puts "originalBg does not exist yet, defining it now\n"
754 set ::originalBg($i) [$::prodTbl rowcget $i -background]
755 puts "ROW PROPERTY: $::originalBg($i) [$::prodTbl rowcget $i -text]\n"
756 }
757 }
758
759 for {set i 0} {$i < [$::prodTbl index end]} {incr i} {
760 puts [$::prodTbl rowcget $i -text ]
761
762 if {[lsearch $input [$::prodTbl cellcget $i,0 -text]] >= 0 } {
763 puts "SHOULD BE HIGHLIGHTING\n"
764 $::prodTbl rowconfigure $i -background yellow
765 }
766 }
767 puts "contents of originalBg\n"
768 parray ::originalBg
769 }

Csaba Nemethi

unread,
Aug 13, 2003, 3:55:16 PM8/13/03
to

Hi Ben,

Everything in your script is OK, except for a missing "$" character to
be prepended to "::originalBg($i)" in line #751. Insert it, and the
script will work as expected.

It's just like in real life: No $, no success. :-)

Best regards,
Csaba

--
Csaba Nemethi http://www.nemethi.de mailto:csaba....@t-online.de

ben bitdiddle

unread,
Aug 15, 2003, 1:19:11 AM8/15/03
to
On Wed, 13 Aug 2003 21:55:16 +0200, Csaba Nemethi wrote:
> Hi Ben,
>
> Everything in your script is OK, except for a missing "$" character to
> be prepended to "::originalBg($i)" in line #751. Insert it, and the
> script will work as expected.
>
> It's just like in real life: No $, no success. :-)
>
> Best regards,
> Csaba

Thanks, the more tired I get, the less I seem to notice when things are
wrong :) What I'm trying to get working now is a "Total" row- I've written
a proc that tacks on a blank row plus a red-highlighted row that shows
"Total: 123.50", for example(the number being the sum of all values in
the corresponding column. Is there a cleaner way to do such a
thing? At one point, I was thinking perhaps to just stick a label in the
scrolled frame where I'm sticking the tablellist, but I realized that if
the window were realized the table and label wouldn't necessarily line
up...

Csaba Nemethi

unread,
Aug 15, 2003, 2:02:56 PM8/15/03
to
ben bitdiddle wrote:

> Thanks, the more tired I get, the less I seem to notice when things are
> wrong :) What I'm trying to get working now is a "Total" row- I've written
> a proc that tacks on a blank row plus a red-highlighted row that shows
> "Total: 123.50", for example(the number being the sum of all values in
> the corresponding column. Is there a cleaner way to do such a
> thing? At one point, I was thinking perhaps to just stick a label in the
> scrolled frame where I'm sticking the tablellist, but I realized that if
> the window were realized the table and label wouldn't necessarily line
> up...

I don't know of any cleaner way.

0 new messages