• crosshair

    From Adrien Peulvast@21:1/5 to All on Wed Dec 14 22:04:59 2022
    Hello Community,

    I found a bug in the "crosshair" package 1.2 (part of tklib):
    File crosshair.tcl, in the function "::crosshair::Unhide" , line 6:
    "set opts(hidden) 1"

    is only defined as local variable, so has no effect to hide the
    crosshair when the mouse leaves the canvas. The crosshair is still
    displayed. It occurs from the second time the cursor leaves the canvas,
    so maybe it's why it was missed during tests.

    I propose the following correction (add 2 lines after line 6):
    # Store changes back.
    set config($w) [array get opts]

    full function:

    proc ::crosshair::Unhide { w x y } {
    variable config
    if { ![info exists config($w)] } return
    array set opts $config($w)

    # Already unhidden, do nothing
    if { !$opts(hidden) } return
    set opts(hidden) 0

    # Store changes back.
    set config($w) [array get opts]

    # Recreate cross-hair. This takes the bounding boxes, if any, into
    # account, i.e. if we are out of bounds nothing will appear.
    Move $w $x $y
    return
    }

    so the config array is updated, the crosshair is hidden when the mouse
    cursor leaves the canvas.

    Someone to look at it and confirm ?

    Thanks !


    --
    Cet e-mail a été vérifié par le logiciel antivirus d'Avast.
    www.avast.com

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adrien Peulvast@21:1/5 to All on Wed Dec 14 22:07:59 2022
    Le 14/12/2022 à 22:04, Adrien Peulvast a écrit :
    Hello Community,

    I found a bug in the "crosshair" package 1.2 (part of tklib):
    File crosshair.tcl, in the function "::crosshair::Unhide" , line 6:
    "set opts(hidden) 1"

    is only defined as local variable, so has no effect to hide the
    crosshair when the mouse leaves the canvas. The crosshair is still
    displayed. It occurs from the second time the cursor leaves the canvas,
    so maybe it's why it was missed during tests.

    I propose the following correction (add 2 lines after line 6):
    # Store changes back.
    set config($w) [array get opts]

    full function:

    proc ::crosshair::Unhide { w x y } {
        variable config
        if { ![info exists config($w)] } return
        array set opts $config($w)

        # Already unhidden, do nothing
        if { !$opts(hidden) } return
        set opts(hidden) 0

        # Store changes back.
        set config($w) [array get opts]

        # Recreate cross-hair. This takes the bounding boxes, if any, into
        # account, i.e. if we are out of bounds nothing will appear.
        Move $w $x $y
        return
    }

    so the config array is updated, the crosshair is hidden when the mouse
    cursor leaves the canvas.

    Someone to look at it and confirm ?

    Thanks !


    edit : the line 6 in function is :
    "set opts(hidden) 0"

    --
    Cet e-mail a été vérifié par le logiciel antivirus d'Avast.
    www.avast.com

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Gerald Lester@21:1/5 to Adrien Peulvast on Wed Dec 14 08:14:38 2022
    On 12/14/22 08:04, Adrien Peulvast wrote:
    Hello Community,

    I found a bug in the "crosshair" package 1.2 (part of tklib):
    File crosshair.tcl, in the function "::crosshair::Unhide" , line 6:
    "set opts(hidden) 1"

    is only defined as local variable, so has no effect to hide the
    crosshair when the mouse leaves the canvas. The crosshair is still
    displayed. It occurs from the second time the cursor leaves the canvas,
    so maybe it's why it was missed during tests.

    I propose the following correction (add 2 lines after line 6):
    # Store changes back.
    set config($w) [array get opts]

    full function:

    proc ::crosshair::Unhide { w x y } {
        variable config
        if { ![info exists config($w)] } return
        array set opts $config($w)

        # Already unhidden, do nothing
        if { !$opts(hidden) } return
        set opts(hidden) 0

        # Store changes back.
        set config($w) [array get opts]

        # Recreate cross-hair. This takes the bounding boxes, if any, into
        # account, i.e. if we are out of bounds nothing will appear.
        Move $w $x $y
        return
    }

    so the config array is updated, the crosshair is hidden when the mouse
    cursor leaves the canvas.

    Someone to look at it and confirm ?

    Thanks !

    May I suggest that you go to the Fossil repo and create a ticket and
    submit a fix.

    --
    +----------------------------------------------------------------------+
    | Gerald W. Lester, President, KNG Consulting LLC |
    | Email: Gerald.Lester@kng-consulting.net | +----------------------------------------------------------------------+

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adrien Peulvast@21:1/5 to All on Wed Dec 14 22:36:30 2022
    Le 14/12/2022 à 22:14, Gerald Lester a écrit :
    On 12/14/22 08:04, Adrien Peulvast wrote:
    Hello Community,

    I found a bug in the "crosshair" package 1.2 (part of tklib):
    File crosshair.tcl, in the function "::crosshair::Unhide" , line 6:
    "set opts(hidden) 1"

    is only defined as local variable, so has no effect to hide the
    crosshair when the mouse leaves the canvas. The crosshair is still
    displayed. It occurs from the second time the cursor leaves the
    canvas, so maybe it's why it was missed during tests.

    I propose the following correction (add 2 lines after line 6):
    # Store changes back.
    set config($w) [array get opts]

    full function:

    proc ::crosshair::Unhide { w x y } {
         variable config
         if { ![info exists config($w)] } return
         array set opts $config($w)

         # Already unhidden, do nothing
         if { !$opts(hidden) } return
         set opts(hidden) 0

         # Store changes back.
         set config($w) [array get opts]

         # Recreate cross-hair. This takes the bounding boxes, if any, into >>      # account, i.e. if we are out of bounds nothing will appear.
         Move $w $x $y
         return
    }

    so the config array is updated, the crosshair is hidden when the mouse
    cursor leaves the canvas.

    Someone to look at it and confirm ?

    Thanks !

    May I suggest that you go to the Fossil repo and create a ticket and
    submit a fix.

    OK, done

    --
    Cet e-mail a été vérifié par le logiciel antivirus d'Avast.
    www.avast.com

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