home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / tcl / 2440 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  1.3 KB

  1. Path: sparky!uunet!elroy.jpl.nasa.gov!henry!mathew
  2. From: mathew@elroy.Jpl.Nasa.Gov (Mathew Yeates)
  3. Newsgroups: comp.lang.tcl
  4. Subject: Can windows be dragged on a canvas?
  5. Date: 22 Jan 93 00:41:52 GMT
  6. Organization: Image Analysis Systems Group, JPL
  7. Lines: 27
  8. Message-ID: <mathew.727663312@henry>
  9. NNTP-Posting-Host: henry.jpl.nasa.gov
  10.  
  11. I notice this isnt done in the widgets demo, is this because it can't be
  12. done? I want to drag a photo widget around on the widget. Instead of
  13. adding the code to make photo a canvas type, somebody recommended
  14. the shortcut of using a window. However, button presses appear to
  15. get intercepted by the window instead of the canvas. Heres a snippet of
  16. code
  17.  
  18. #create the window containing a photo widget and make it an item on
  19. #the canvas
  20. canvas .canvas -scrollregion {0 0 400 400} -width 400 -height 400
  21. frame .canvas.frame
  22. photo .canvas.frame.photo
  23. pack append .canvas.frame .canvas.frame.photo {top}
  24. .canvas create window 0 0 -window .canvas.frame -anchor nw -tags canvasitem
  25. pack append . .canvas {top}
  26. readppm .canvas.frame.photo teapot.ppm
  27.  
  28. #bind button presses: this does not work!
  29. bind .canvas <1> "itemStartDrag .canvas %x %y"
  30. bind .canvas <B1-Motion> "itemDrag .canvas %x %y"
  31.  
  32.  
  33. Any ideas? Or do I have to go through the hassle of writing the
  34. code to make photo a canvas type?
  35.  
  36. Mathew Yeates
  37.  
  38.