Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Color (Pls...Help)

Status
Not open for further replies.

kokoko12000

Programmer
Apr 14, 2003
13
0
0
US
Hi all,
I have a set of points arranged as a grid. These points are created as ovals (or rects). They all have a default color. Now when the user clicks on a any oval its color should change to a diff. color. when the user clicks again on it, it shud come to its default color (i.e., toggle the color when the mouse is clicked). This should work for all the remaining ovals/rects present. Please suggest any ideas of doing this...pls...

-j


 
ok....finall got the soln.

set color1 blue
set color2 gray
set currentcolor [.c itemcget current -fill]
if { $currentcolor == $color1 } {
.c itemconfig current -fill $color2
} else { .c itemconfig current -fill $color1 }
 
The use of the current index is an elegant solution.

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top