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

I am half way through my 3rd year s

Status
Not open for further replies.

zskater

Programmer
Apr 14, 2001
22
GB
I am half way through my 3rd year software enginering project at uni ,we are now into the implemetation stage.
None of our team have ever used tcl/tk before so we are having a lot of trouble.

What I need to know can be simplified to the following

when I click on a button that I have already created I want
a rectangle to appear attached to the cursor so i can then move it onto a canvas, then when i click the mouse button it releases the rectangle onto the canvas.
(I also need a grid on the canvas that the rectangles will snap onto, but that can wait till later)

Hope someone can help cheers
STEVE
 
What you're asking for is basically "drag-and-drop" functionality. There's no built-in mechanism for it in Tcl, but there are a variety of approaches to implementing it. The Tcler's Wiki, a collaboratively-edited collection of Tcl wisdom, has some pages on adding drag-and-drop to Tcl applications. You can access the main Tckler's Wiki page with the PURL
Several Tcl extensions have some type of drag-and-drop mechanism, some that work only within a single application, and some that work with interprocess communication hooks for interprocess drag and drop. They're listed on the Wiki page
There's also a nice example of implementing drag-and-drop at It configures the cursor to indicate a dragging state, so that might not give you enough flexibility in your visual representation, but it's a nice approach.

I've also put together a quick drag-and-drop skeleton for use within a single application. I posted it in response to a question on the comp.lang.tcl newsgroup. You can find it on the Google Groups newsgroup archive ( specifically at

Hope this helps! - Ken Jones, President
Avia Training and Consulting
866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Thanks very much for your reply, I am working on it trying to adapt it for our program

Cheers Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top