• dchars bug

    From Adrien Peulvast@21:1/5 to All on Sat Jan 22 16:08:50 2022
    Hello community,
    Use of "dchars" on canvas line leads to an error.
    Consider the following code (simplified from my app where I draw
    polylines, add and remove points and clone lines):
    pack [canvas .c]
    set myline [.c create line 10 10 50 50]; # a simple line
    .c dchars $myline 2; # delete second point, now line is displayed as a point
    .c coords $myline; # -> "10 10". Line is defined with 2 coordinates
    .c type $myline; # -> "line"; # -> used in code as verification that
    clone operation is performed on lines only.
    .c create line [.c coords $myline]; # -> as expected, result is : wrong
    # coordinates: expected at least 4, got 2

    This "dchars" operation on line alter its nature.

    Thanks !



    --
    L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
    https://www.avast.com/antivirus

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christian Gollwitzer@21:1/5 to All on Sat Jan 22 09:20:57 2022
    Am 22.01.22 um 09:08 schrieb Adrien Peulvast:
    Hello community,
    Use of "dchars" on canvas line leads to an error.
    Consider the following code (simplified from my app where I draw
    polylines, add and remove points and clone lines):
    pack [canvas .c]
    set myline [.c create line 10 10 50 50]; # a simple line
    .c dchars $myline 2; # delete second point, now line is displayed as a
    point
    .c coords $myline; # -> "10 10". Line is defined with 2 coordinates
    .c type $myline; # -> "line"; # -> used in code as verification that
    clone operation is performed on lines only.
    .c create line [.c coords $myline]; # -> as expected, result is : wrong
    # coordinates: expected at least 4, got 2

    This "dchars" operation on line alter its nature.

    You cannot create a line from a single coordinate, but apparently you
    can delete the penultimate point, as you have shown.

    You are right that this seems inconsistent.

    Q: How should it be fixed? If we decide that a line must contain at
    least 4 points, then the dchars should throw an error. Alternatively,
    the error from the creation of one point only could be removed.

    Christian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)