home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!elroy.jpl.nasa.gov!henry!mathew
- From: mathew@elroy.Jpl.Nasa.Gov (Mathew Yeates)
- Newsgroups: comp.lang.tcl
- Subject: Can windows be dragged on a canvas?
- Date: 22 Jan 93 00:41:52 GMT
- Organization: Image Analysis Systems Group, JPL
- Lines: 27
- Message-ID: <mathew.727663312@henry>
- NNTP-Posting-Host: henry.jpl.nasa.gov
-
- I notice this isnt done in the widgets demo, is this because it can't be
- done? I want to drag a photo widget around on the widget. Instead of
- adding the code to make photo a canvas type, somebody recommended
- the shortcut of using a window. However, button presses appear to
- get intercepted by the window instead of the canvas. Heres a snippet of
- code
-
- #create the window containing a photo widget and make it an item on
- #the canvas
- canvas .canvas -scrollregion {0 0 400 400} -width 400 -height 400
- frame .canvas.frame
- photo .canvas.frame.photo
- pack append .canvas.frame .canvas.frame.photo {top}
- .canvas create window 0 0 -window .canvas.frame -anchor nw -tags canvasitem
- pack append . .canvas {top}
- readppm .canvas.frame.photo teapot.ppm
-
- #bind button presses: this does not work!
- bind .canvas <1> "itemStartDrag .canvas %x %y"
- bind .canvas <B1-Motion> "itemDrag .canvas %x %y"
-
-
- Any ideas? Or do I have to go through the hassle of writing the
- code to make photo a canvas type?
-
- Mathew Yeates
-
-