B4J Question Hover event on panes

Cableguy

Expert
Licensed User
Longtime User
Doing some trying out, I found that MouseMoved event can be used as a Mouse_Entered event.... Now I would need to have a mouse_exited event!
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
You can add onMouseEntered and onMouseExited to any node as far as I know.
B4X:
...
        MouseOver(b(a))
        Next  
End Sub
Sub MouseOver(n1 As Node)
        setHandler(n1,"setOnMouseEntered","mouseIn")
        setHandler(n1,"setOnMouseExited","mouseOut")
End Sub
Sub setHandler(ob As JavaObject,eventName As String,handlerName As String)
ob.RunMethod(eventName, Array(ob.CreateEventFromUI("javafx.event.EventHandler",handlerName,True)))
End Sub
Sub mouseIn_Event(m As String,args() As Object)
    Log("In "& asJO(Sender).RunMethod("getId",Null))
End Sub
Sub mouseOut_Event(m As String,args() As Object)
    Log("Out "& asJO(Sender).RunMethod("getId",Null))
End Sub
Sub asJO(o As JavaObject) As JavaObject
    Return o
End Sub
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
You can use Mainform.Rootpane as the node.
It wont detect when user hovers over the window title bar though, only when they enter/leave the rootpane area of the form.
 
Upvote 0

ThRuST

Well-Known Member
Licensed User
Longtime User
With risk to feel intimidated by my question, I want to ask what's the ... command in the example? Dim a as ImageView? that's for my need at least. Cheers
 
Upvote 0
Top