iOS Question Button with touch drag exit ?? touch drag inside ??

Alberto Iglesias

Well-Known Member
Licensed User
Hello everyone,

Whats the best way to create a button can be pressed WITHOUT unpress your finger?

for example:

we have this two buttons on screen:

[<-] and [->]

imagine the user press on screen on first button and drag the finger to another button (without untouch screen)

I need to receive two events: on first button (untouch) and second (touch)

is it possible on B4i?

thank you
 

Erel

Administrator
Staff member
Licensed User
Create a panel. Put two image views or labels and handle the panel Touch event. You can find the "pressed" one based on the touch position.
 

Alberto Iglesias

Well-Known Member
Licensed User
@Erel , even with Panels, dont work, because when you press one panel is working fine, but if you DO NOT UNPRESS and drag to another, this second one not firing the touch event

1585259965425.png


B4X:
Sub pnlButtonA_Touch(Action As Int, X As Float, Y As Float)
    Log("Button A = " & Action & "/" & X & "/" & Y)
End Sub

Sub pnlButtonB_Touch(Action As Int, X As Float, Y As Float)
    Log("Button B = " & Action & "/" & X & "/" & Y)
End Sub
Look this log below, in this point, when drag the finger from B to A, I dont start to receive the A events, any idea? or you mean create JUST ONE PANEL and put two fake buttons inside?

1585259784630.png
 
Last edited:

JordiCP

Well-Known Member
Licensed User
You need to use a single panel with 2 images, and handle just one event. Depending on the touch position, assign action to one or other as if they were 2 independent buttons
 
Top