B4J Question AS CalendarAdvanced and Gesture Trackpad

MarcoRome

Expert
Licensed User
Longtime User
Hi dear Alexander.
I don't know how as_view works (I haven't looked at the library).
And I don't know if these two examples can help you.

I have prepared 2 examples for you:
The former intercepts whether the mouse is inside the object or if it is outside the object. You could eventually "stop" the gesture capability inside as_view.

B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
  
'First Example if the mouse is inside the object ( example calendar )
Dim JO As JavaObject = Pane1 'or Whichever Node you are tracking
Dim O As Object = JO.CreateEventFromUI("javafx.event.EventHandler","MouseEntered",Null)
JO.RunMethod("setOnMouseEntered",Array(O))
Dim O As Object = JO.CreateEventFromUI("javafx.event.EventHandler","MouseExited",Null)
JO.RunMethod("setOnMouseExited",Array(O))


End Sub


Private Sub MouseEntered_Event (MethodName As String, Args() As Object)
Log("Mouse inside")

End Sub

Private Sub MouseExited_Event (MethodName As String, Args() As Object)
Log("Mouse Out")
End Sub



The second intercept right if you use the SWIPE (trackpad) to the right or left

B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
 

'Next Example if SWIPE LEFT O RIGHT
Dim R As Reflector
    R.Target = MainForm.RootPane
R.AddEventFilter("SwipeLeft","javafx.scene.input.SwipeEvent.SWIPE_LEFT")
R.AddEventFilter("SwipeRight","javafx.scene.input.SwipeEvent.SWIPE_RIGHT")
End Sub

Private Sub SwipeLeft_Filter (E As Event)
Dim MouseEvent As JavaObject = E
Log("SWIPE_LEFT")
End Sub

Private Sub SwipeRight_Filter (E As Event)
Dim MouseEvent As JavaObject = E
Log("SWIPE_RIGHT")
End Sub
 

Alexander Stolte

Expert
Licensed User
Longtime User
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
The code also responds my scrolling, but unfortunately only when I am at the top and scroll further up. The same at the bottom when I scroll further down. Unfortunately not when I scroll normally in the list.
B4X:
Dim R As Reflector
R.Target = xclv_main.sv
R.AddEventHandler("ScrollPaneScroll","javafx.scene.input.ScrollEvent.SCROLL")

Sub ScrollPaneScroll_Event(e As Event)
    Log("Scrolled")
    e.Consume
End Sub
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Do you have tried these alternatives ( SCROLL_STARTED, ROTATION_STARTED ) ?

B4X:
R.AddEventHandler("ScrollPaneScroll","javafx.scene.input.ScrollEvent.SCROLL_STARTED")

B4X:
R.AddEventHandler("ScrollPaneScroll","javafx.scene.input.RotateEvent.ROTATION_STARTED")


1675232968649.png
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
I develop my own B4J pager without relying on the xCustomListView. There is another problem where I had not found a solution at that time either.

A custom development is probably the best solution.
I made the change. And on Trackpad it works fine. Basically, not being able to manage the trackpad (to lock it only in the object of interest) I managed to add an "if using a trackpad" property in the design. This eliminates the header and adds the month/day for the days so as to have, for example, Feb/Mon and so on.
On the test that we have carried out using the Trackpad ( of a MAC ) it works without any problem.


This is the result using a TrackPad

 
Upvote 0
Top