Alberto Iglesias Well-Known Member Licensed User Longtime User Mar 26, 2020 #1 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
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 B4X founder Staff member Licensed User Longtime User Mar 26, 2020 #2 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. Upvote 0
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 Longtime User Mar 26, 2020 #3 OK. I will try with panel... thanks Upvote 0
Alberto Iglesias Well-Known Member Licensed User Longtime User Mar 26, 2020 #4 @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 Code: 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? Last edited: Mar 26, 2020 Upvote 0
@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 Code: 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?
JordiCP Expert Licensed User Longtime User Mar 26, 2020 #5 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 Upvote 0
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
Alberto Iglesias Well-Known Member Licensed User Longtime User Mar 26, 2020 #6 JordiCP said: 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 Click to expand... Yes, Im trying to do this right now! thank youuuuuuuu Upvote 0
JordiCP said: 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 Click to expand... Yes, Im trying to do this right now! thank youuuuuuuu