B4J Question Capture event (pane moving)

micro

Well-Known Member
Licensed User
Longtime User
Hi
How can I capture the motion event of a panel? (Pane)
With raspberry when the virtual keyboard is activated and com.sun.javafx.vk.adjustwindow is set to true,
the window moves upwards.
I can capture this movement?
Thanks
 

jmon

Well-Known Member
Licensed User
Longtime User
A way to do it, is with the change listeners:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Main") 'Load the layout file.
    MainForm.Show
  
    Dim Obj As Reflector
    Obj.Target = MainForm.RootPane
    Obj.AddChangeListener("pane", "layoutBoundsProperty")
End Sub

Private Sub pane_Changed(Old As Object, New As Object)
    Log("changed")
End Sub
In this case, I monitor any change of the layout bounds (translate, scale ...).

You could test monitoring other changes in properties:
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/Node.html#translateXProperty--
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/Node.html#layoutYProperty--
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/Node.html#layoutXProperty--
...etc...

This is not the "clean" fix for this problem, but it will work while searching for the real fix. :)
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
This is not the "clean" fix for this problem, but it will work while searching for the real fix. :)
you're right, the sub "pane_changed" is activate only when the layout is loaded but not when the keyboard moves the panel upwards and forwards.
I can not understand that and how property use, I'm not a expert in pure java
thanks anyway
 
Upvote 0
Top