I want to be able to move views across the screen with the finger.
I use a panel onto which rest several views.
At this moment, I iterate through GetAllViewsRecursive and use a small sub to check if the finger is within the boundaries of the view. If so I record the view, x and y.
Right now in the small test project I have only 3 labels.
My problem is that it can take between 800 and 1045 milliseconds to find the view among three. My plan is to use that for 20 views or so.
Ideally, it would be nice to use an event in the view itself to signal the panel touch event which view has been touched.
I tried to return false in the view Click event, but still, the view consumes the event.
In another basic, I could use mouseDown in the view to move instead. Is there any way I could do that ? Perhaps through Java ?
TIA
I use a panel onto which rest several views.
At this moment, I iterate through GetAllViewsRecursive and use a small sub to check if the finger is within the boundaries of the view. If so I record the view, x and y.
B4X:
Sub PnlMoveView_Touch (Action As Int, X As Float, Y As Float)
If Action = 0 Then'Action Down
For Each v As View In PnlMoveView.GetAllViewsRecursive
If Within(v, PnlMoveView, X, Y) Then
DownX = x
DownY = y
ViewToMove = v
Log("Return " & (DateTime.Now - n))
Log("> " & ViewToMove.Tag)
Return
End If
Next
'.../...
end sub
Sub Within(v As View, Pnl As Panel, x As Int, y As Int) As Boolean
Return (x > v.Left And x < v.Left + v.Width And y > v.Top And y < v.Top + v.height)
End Sub
Right now in the small test project I have only 3 labels.
My problem is that it can take between 800 and 1045 milliseconds to find the view among three. My plan is to use that for 20 views or so.
Ideally, it would be nice to use an event in the view itself to signal the panel touch event which view has been touched.
I tried to return false in the view Click event, but still, the view consumes the event.
In another basic, I could use mouseDown in the view to move instead. Is there any way I could do that ? Perhaps through Java ?
TIA