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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Canvas Problems

Status
Not open for further replies.

SmallProgram

Programmer
Feb 6, 2002
42
IN
Hello Friends,
Now that I have got lot of help from this site Iam feeling very much at Independence to ask you people silly doubtsalso.Please bear withme and answer my questions.
Now My question is that I want to edit the objects that are generated at runtime on a canvas.What I mean is that If I draw line or a oval or a rectangle how to identify them after a series of events and how to edit them i.e how to change their properties.
I mean can we get their identification (ids) and can we use the configure tag.
Please Answer me
Thanks in Advance.
Mallik. Programmer,Amatuer
 
When you create objects on the canvas, the "create" command returns the id: set cid1 [.c create line $x1 $y1 $x2 $y2]
Then you can change the configuration:

pathName itemconfigure tagOrId ?option? ?value? ?option value ...? Bob Rashkin
rrashkin@csc.com
 
You can also apply tags to canvas items, and then manipulate them later by using the tag names instead of the IDs. For example:

[tt]pack .c
.c create rectangle 20 20 120 120 -tags fred
.c create oval 150 30 190 100 -tags {fred barney}
.c itemconfigure barney -fill red -outline
.c move fred 5 50[/tt] - Ken Jones, President
Avia Training and Consulting
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Thank u Mr.Ken.
It solved my problem.
Mallik. Programmer,Amatuer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top