home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / tcl / 1229 < prev    next >
Encoding:
Internet Message Format  |  1992-08-19  |  2.7 KB

  1. Path: sparky!uunet!kithrup!stanford.edu!agate!bionet!uwm.edu!zaphod.mps.ohio-state.edu!sdd.hp.com!mips!carbon!news.cs.indiana.edu!syscon!gator!fang!att!cbnewsl!cbnewsm!gah
  2. From: gah@att.com (George A. Howlett)
  3. Newsgroups: comp.lang.tcl
  4. Subject: Re: canvas problem
  5. Message-ID: <1992Aug19.182110.12233@cbnewsm.cb.att.com>
  6. Date: 19 Aug 92 18:21:10 GMT
  7. References: <1992Aug18.023804.25826@Arco.COM>
  8. Sender: news@cbnewsm.cb.att.com (NetNews Administrator)
  9. Reply-To: george.howlett@att.com
  10. Organization: AT&T Bell Laboratories
  11. Lines: 69
  12. X-Newsreader: Tin 1.1 PL5
  13. Nntp-Posting-Host: grenache.cnet.att.com
  14.  
  15. Chris Phillips  (214) 754-6419 (cgp@Arco.COM) wrote:
  16. : For some reason the following script doesn't give the expected results.
  17. : It creates two canvases: one horizontal and one vertical.  They should
  18. : each create 10 squares, all in a row.  The horizontal canvas is ok, but
  19. : only 2 squares show up in the vertical canvas.
  20. : #!/usr/local/bin/wish -f
  21. : proc trash {w doy} {
  22. :         toplevel $w
  23. :         if {$doy == 1} {
  24. :                 canvas $w.c -width 1c -height 10c
  25. :                 $w.c create rectangle 0 0 1c 10c -fill red
  26. :                 for {set j 1} {$j <= 10} {incr j} {
  27. :                         $w.c create rectangle \
  28. :                           0 [expr $j-1]c 1c ${j}c \
  29. :                           -outline black -fill blue
  30. :                 }
  31. :         } else {
  32. :                 canvas $w.c -width 10c -height 1c
  33. :                 $w.c create rectangle 0 0 10c 1c -fill red
  34. :                 for {set i 1} {$i <= 10} {incr i} {
  35. :                         $w.c create rectangle \
  36. :                           [expr $i-1]c 0 ${i}c 1c \
  37. :                           -outline black -fill blue
  38. :                 }
  39. :         }
  40. :         pack append $w $w.c {expand fill}
  41. : }
  42. : trash .t0 0
  43. : trash .t1 1
  44. : message .m -text "Horizontal: 10 blue squares\nVertical: 2 blue squares" \
  45. :   -aspect 1500 -justify center
  46. : pack append . .m {expand fill}
  47. : ----- End script -----
  48. : Any ideas?
  49. : Chris
  50.  
  51. In case you haven't already received the fix...
  52.  
  53. --gah
  54.  
  55. *** tkCanvas.c-dist    Sat Aug  8 21:11:42 1992
  56. --- tkCanvas.c    Wed Aug 19 13:57:39 1992
  57. ***************
  58. *** 1546,1552 ****
  59.       screenX1 = canvasPtr->xOrigin;
  60.       screenY1 = canvasPtr->yOrigin;
  61.       screenX2 = screenX1 + Tk_Width(tkwin);
  62. !     screenY2 = screenY1 + Tk_Width(tkwin);
  63.       if (canvasPtr->redrawX1 > screenX1) {
  64.       screenX1 = canvasPtr->redrawX1;
  65.       }
  66. --- 1546,1552 ----
  67.       screenX1 = canvasPtr->xOrigin;
  68.       screenY1 = canvasPtr->yOrigin;
  69.       screenX2 = screenX1 + Tk_Width(tkwin);
  70. !     screenY2 = screenY1 + Tk_Height(tkwin);
  71.       if (canvasPtr->redrawX1 > screenX1) {
  72.       screenX1 = canvasPtr->redrawX1;
  73.       }
  74.