Skia ButtonBehavior loses hover when receiving non mouse notifications

Skia ButtonBehavior loses the Is Hovered property when receiving non mouse notifications (such as keyboard input).

In this example the button is supposed to change color when pressing Space while hovering over.


A proposed fix is contained in the attached VL document.
Also included is a SelectableMouseButtonButtonBehavior which allows to choose which mouse button the button reacts to, might be a nice addition in the Skia library (although with a better name).

VL.Skia.Behaviors.vl (86.9 KB)

Another issue is when 2 or more buttons are adjacent and the mouse goes from one to the other, the first might never receive notifications letting it know that the mouse has left and therefore the hover becomes stuck. This can happen even when there is a gap between the buttons but the mouse moves quickly.


thanks domj!

I refined the behavior partly by shameless copying your ideas. The upcoming version will also come with a way to filter for a set of buttons. The user of the button can specify this by using a bitwise OR of the mouse button enum. see panels demo.

@gregsn Just checked it out, looks great, thanks! Didn’t know there’s the option to combine enum values like this, very handy.

Just one thing with the current implementation (gamma 222), I think you left some testing code that presses down on a mouse button using the space bar.

Also there’s still the adjacent hover issue but I guess I should open another thread for that.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.