Version 0 of Dash lines on Windows

Updated 2005-07-15 14:52:05

On Linux, it works correctly: the drawings left and right are drawn with dashed lines. On Windows, the dash-pattern is ignored when the width is 2 or more.


#!/bin/bash # the next line restarts using wish \

  exec /usr/bin/wish "$0" "$@"

 #: WinDash.tcl - HaJo Gurt - 2005-07-13
 #: Bug-Demo: On Windows, dash-patterns only work with width 1

 #########1#########2#########3#########4#########5#########6#########7#####

  package require Tk

  grid [canvas .c -width 300 -height 325]

  # dash-patterns: {2 4}  {2 8}  {6 4}  {6 4 2 4}  {6 4 2 4 2 4}

  .c create oval  25  25  125 125  -width 1 -dash {2 4}  -fill grey60
  .c create oval 175  25  275 125  -width 2 -dash .  

  .c create line  20 150  130 150  -fill grey30  -width 1  -dash {6 4 2 4 2 4} 
  .c create line 170 150  280 150                -width 2  -dash {6 4 2 4} 

  for {set y 170} {$y<=180} {incr y} {
    .c create line  20 $y  280 $y  -fill grey30  -width 1  -dash {2 4 6 4}  ;# -dash .-
  }

  .c create rect  25 200  125 300  -fill grey70  -width 1  -dash {6 4}
  .c create rect 175 200  275 300                -width 2  -dash -

The tcl-help text says "all values in the dash list will be multiplied by the line width before display. This assures that "." will always be displayed as a dot and "-" always as a dash regardless of the line width."

But on Windows, it looks like the dash-pattern is ignored when the width is 2 or more.