Ivan Vidak
Member
Hi,
I am working on multitouch in B4J and I have some questions.
Idea is to have pane same size as form, and when there is touch event on pane i get data on x, y, id of touch...
My code is here:
Here is Log:
With Log(Arg(0)) I can get lot of data regarding touch, like touchCount, id, x, y.
Problem is that it's all in same string. I can parse string and get data I need, but is there some other way to do this?
Something where I can extract exact parameter.
Like: jo.RunMethod("setOnTouchMoved.touchCount", Array(e))?
Thanks
I am working on multitouch in B4J and I have some questions.
Idea is to have pane same size as form, and when there is touch event on pane i get data on x, y, id of touch...
My code is here:
B4X:
#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private TouchPane As B4XView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Multitouch") 'Load the layout file.
MainForm.Show
Dim jo As JavaObject = TouchPane
Dim e As Object = jo.CreateEvent("javafx.event.EventHandler", "Touch", False)
jo.RunMethod("setOnTouchMoved", Array(e))
End Sub
Sub Touch_Event (Method As String, Arg() As Object)
If Arg <> Null Then
Log(Arg(0))
End If
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Here is Log:
B4X:
TouchEvent [source = PaneWrapper$ConcretePaneWrapper$NonResizePane@7f641f8c, target = PaneWrapper$ConcretePaneWrapper$NonResizePane@7f641f8c, eventType = TOUCH_MOVED, consumed = false, touchCount = 1, eventSetId = 117, touchPoint = TouchPoint [state = MOVED, id = 1, target = PaneWrapper$ConcretePaneWrapper$NonResizePane@7f641f8c, x = 341.0, y = 390.0, z = 0.0, pickResult = PickResult [node = PaneWrapper$ConcretePaneWrapper$NonResizePane@7f641f8c, point = Point3D [x = 341.0, y = 390.0, z = 0.0], distance = 1119.6152422706632]]
TouchEvent [source = PaneWrapper$ConcretePaneWrapper$NonResizePane@7f641f8c, target = PaneWrapper$ConcretePaneWrapper$NonResizePane@7f641f8c, eventType = TOUCH_MOVED, consumed = false, touchCount = 2, eventSetId = 133, touchPoint = TouchPoint [state = MOVED, id = 2, target = PaneWrapper$ConcretePaneWrapper$NonResizePane@7f641f8c, x = 218.0, y = 433.0, z = 0.0, pickResult = PickResult [node = PaneWrapper$ConcretePaneWrapper$NonResizePane@7f641f8c, point = Point3D [x = 218.0, y = 433.0, z = 0.0], distance = 1119.6152422706632]]
With Log(Arg(0)) I can get lot of data regarding touch, like touchCount, id, x, y.
Problem is that it's all in same string. I can parse string and get data I need, but is there some other way to do this?
Something where I can extract exact parameter.
Like: jo.RunMethod("setOnTouchMoved.touchCount", Array(e))?
Thanks