Android Question Panel receives only the Touch event

mindful

Active Member
Licensed User
Panel receives only the Touch event. If I have an activity with all the events of a panel (Click, LongClick and Touch) only the touch will be received. If I remove the Touch sub then the click and LongClick will be received. Is this by design ? As I have read some other posts some people use click and touch events together and this is what I want to do also.

I have created a test project - a zip file is attached to the first file of another post :
https://www.b4x.com/android/forum/threads/button-always-on-top-of-panel.98175/
 

DonManfred

Expert
Licensed User
Longtime User
return false from the touch event if you do not want to handle the result.
Return true if you want to consume the touch.
 
Upvote 0

mindful

Active Member
Licensed User
return false from the touch event
I just tried and it doesn't work. when I type Private Sub the Space and Tab and select the Panel and then the Touch event ... this generates a Sub without a As (return) Boolean. So I added one myself and tested but no luck. Only The touch event is received.

B4X:
Sub Panel1_Touch (Action As Int, X As Float, Y As Float) As Boolean
    Log("Panel1_Touch")
    Return False
End Sub
Sub Panel1_Click
    Log("Panel1_Click")
End Sub
Sub Panel1_LongClick
    Log("Panel1_LongClick")
End Sub
 
Upvote 0

mindful

Active Member
Licensed User
Looks like you need to emulate/recognize the click or longclick by yourself if you are using the touch event
This is no problem for me. I am creating an xui custom view and in b4j the pane touch and mouseclick are received. As I saw in b4a that i have the click and touch i thought that i can use them both.

I will report a bug for this thing. Maybe a notice should pe placed if this really is a bug.
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
Panelwrapper in ontouch raises an event (instead of callback) and returns true in any case.
Anyway if to set OnTouchListener using inline java, all works like expected.
 
Upvote 0
Top