home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!destroyer!news.itd.umich.edu!spencer
- From: spencer@med.umich.edu (Spencer W. Thomas)
- Newsgroups: comp.lang.tcl
- Subject: Re: Can windows be dragged on a canvas?
- Date: 22 Jan 93 10:53:20
- Organization: University of Michigan HSITN
- Lines: 19
- Message-ID: <SPENCER.93Jan22105320@guraldi.med.umich.edu>
- References: <mathew.727663312@henry>
- NNTP-Posting-Host: guraldi.itn.med.umich.edu
- In-reply-to: mathew@elroy.Jpl.Nasa.Gov's message of 22 Jan 93 00:41:52 GMT
-
- I've done this. You have to make the bindings to the window, not to
- the canvas:
-
- # Bind the actions ($f is the window name, $theCanvas is the
- # canvas name).
- bind $f <B3-Motion> "itemDrag $theCanvas \
- \[expr %x+\[winfo x $f]]\
- \[expr %y+\[winfo y $f]] $field";
- bind $f <3> "itemStartDrag $theCanvas \[expr %x+\[winfo x $f]]\
- \[expr %y+\[winfo y $f]]";
-
- The trick is that the %x and %y are relative to the window origin, so
- you have to add the position of the window relative to the canvas
- origin to reposition them.
-
- --
- =Spencer W. Thomas | Info Tech and Networking, B1911 CFOB, 0704
- "Genome Informatician" | Univ of Michigan, Ann Arbor, MI 48109
- Spencer.W.Thomas@med.umich.edu | 313-747-2778, FAX 313-764-4133
-