B4J Code Snippet setMouseTransparent, enable mouse events in underlying nodes

Subject: Routine to enable mouse events being transmitted to underlying nodes.

In B4J, when a node covers other nodes, like a Pane, the mouse events are not submitted to underlying nodes.
This is the same as in B4i, it is inverse in B4A.
In B4i, you can use the UserInteractionEnabled property.
In B4J you can use the code below to enable mouse events beeing submitted to underlying nodes.

Private jo = MyNode As JavaObject
jo.RunMethod("setMouseTransparent", Array As Object(True))

The value is False by default.

Tags: Node, mouse events, pass mouse events

Attached a small test project.
If you click on the covered part of button Test2, nothing happens.
If you click on the covered part of button Test1, the mouse event is raised.


  • setMouseTransparent.zip
    30.9 KB · Views: 311
Last edited: