• Tk 8.6.16 Enter/Leave events in megawidgets

    From Ralf Fassel@ralfixx@gmx.de to comp.lang.tcl on Tue Jul 29 18:28:45 2025
    From Newsgroup: comp.lang.tcl

    https://core.tcl-lang.org/tk/tktview/47d4f291598222849fc0121e7ffbdee53766ce77 deliberately changed the behaviour of Enter/Leave events of widgets in a parent/child relationship: now when entering a child, the parent gets a
    leave event.

    This however kills tooltips on the parent, which previously (up to tk
    8.6.12) worked on both, parent *and* child.

    This is unfortunate, if the red widget is considered part of the green
    one, as is typically the case in mega-widgets:

    pack [frame .f -bg green1 -width 140 -height 120]
    pack propagate .f false
    pack [frame .f.f1 -bg red -width 100 -height 100] -side top

    package require tooltip
    tooltip::tooltip .f "Entering f"

    - move the mouse *from the bottom* into the green area: "Entering .f" appears - move the mouse further up to the red area: "Entering .f" disappears

    Prior to the change, the tooltip stayed when the red area was entered.

    - an inconsistency is that when you enter the red area *from the top*
    (without entering or crossing the green area), the tooltip "Entering .f"
    appears nevertheless!

    Is there any smart advice how to handle that situation other than
    traversing the hierarchy when setting the tooltip?

    TNX
    R'
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From saito@saitology9@gmail.com to comp.lang.tcl on Tue Jul 29 12:57:42 2025
    From Newsgroup: comp.lang.tcl

    On 7/29/2025 12:28 PM, Ralf Fassel wrote:
    https://core.tcl-lang.org/tk/tktview/47d4f291598222849fc0121e7ffbdee53766ce77 deliberately changed the behaviour of Enter/Leave events of widgets in a parent/child relationship: now when entering a child, the parent gets a
    leave event.



    Is there any smart advice how to handle that situation other than
    traversing the hierarchy when setting the tooltip?


    How interesting! Just a few days ago I came across a quite similar
    behavior after upgrading to 8.6.16. The Enter/Leave events were not
    behaving properly. After quite a bit of trying to see why, I came up
    with a solution that seems to work: Just add a smalll delay in your
    event handlers. I used "after 50".






    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Ralf Fassel@ralfixx@gmx.de to comp.lang.tcl on Wed Jul 30 10:46:34 2025
    From Newsgroup: comp.lang.tcl

    * saito <saitology9@gmail.com>
    | On 7/29/2025 12:28 PM, Ralf Fassel wrote:
    | > https://core.tcl-lang.org/tk/tktview/47d4f291598222849fc0121e7ffbdee53766ce77
    | > deliberately changed the behaviour of Enter/Leave events of widgets in a
    | > parent/child relationship: now when entering a child, the parent gets a
    | > leave event.

    | > Is there any smart advice how to handle that situation other than
    | > traversing the hierarchy when setting the tooltip?

    | How interesting! Just a few days ago I came across a quite similar
    | behavior after upgrading to 8.6.16. The Enter/Leave events were not
    | behaving properly. After quite a bit of trying to see why, I came up
    | with a solution that seems to work: Just add a smalll delay in your
    | event handlers. I used "after 50".

    Could you post some more detail on your situation? What did you trigger
    with Enter/Leave, what was the problem, and how did adding a delay solve
    the problem?

    In my situation the 'problem' is the 'new' (2024, well... :-) Leave event, which did not come before 8.6.13. I don't see how adding a delay would
    affect the tooltips 'cancel'-action in response to the Leave event: it
    does IMHO not matter whether the tooltip is cancelled now or 50ms
    later...

    TNX
    R'
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From saito@saitology9@gmail.com to comp.lang.tcl on Wed Jul 30 12:23:42 2025
    From Newsgroup: comp.lang.tcl

    On 7/30/2025 4:46 AM, Ralf Fassel wrote:
    * saito <saitology9@gmail.com>
    | with a solution that seems to work: Just add a smalll delay in your
    | event handlers. I used "after 50".

    Could you post some more detail on your situation? What did you trigger
    with Enter/Leave, what was the problem, and how did adding a delay solve
    the problem?

    I wish I could post the code, but it is a pop up window composed of
    several widgets. Each of those widgets have their own bindings, like B1
    click, release, etc. They also have an Enter/Leave events. This had been working fine for some years. A few weeks ago I upgraded to 8.6.16. And
    a few days ago I noticed the change: The window was closing off too
    early by itself. It turned out to be related to mouse movements. Adding
    a delay at the top of the Enter/Leave handler fixed it. In my case, the Enter/Leave event handler is the same for all widgets. Perhaps that is
    the key: if duplicate events are ignored, a delay lets things settle
    down and it fires once.



    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Ralf Fassel@ralfixx@gmx.de to comp.lang.tcl on Wed Jul 30 18:57:41 2025
    From Newsgroup: comp.lang.tcl

    * Ralf Fassel <ralfixx@gmx.de>
    | Is there any smart advice how to handle that situation other than
    | traversing the hierarchy when setting the tooltip?

    I have created a ticket for this:

    https://core.tcl-lang.org/tklib/tktview/9924aee88145dde4d5147b2e9d87b048201c34b4

    R'
    --- Synchronet 3.21a-Linux NewsLink 1.2