E enonod Well-Known Member Licensed User Longtime User Feb 10, 2013 #1 Holding the finger on the screen too long causes retrigger of this Touch code. Can I do anything to accept only the first triggering please? This acts a bit like the PC keyboard queue. [Edit] Is there a queue I can empty at some point in the code? Code: Copy Sub pnl_Touch(Action As Int, X As Float, Y As Float) Dim col,row As Byte If Action=0 col=X/(kCellwh+1) : row=Y/(kCellwh+1) ... End If End Sub Last edited: Feb 10, 2013
Holding the finger on the screen too long causes retrigger of this Touch code. Can I do anything to accept only the first triggering please? This acts a bit like the PC keyboard queue. [Edit] Is there a queue I can empty at some point in the code? Code: Copy Sub pnl_Touch(Action As Int, X As Float, Y As Float) Dim col,row As Byte If Action=0 col=X/(kCellwh+1) : row=Y/(kCellwh+1) ... End If End Sub
E enonod Well-Known Member Licensed User Longtime User Feb 11, 2013 #2 Seems that changing Action 0 Down to Action 1 Up has cured the problem, if anybody else experiences it. Upvote 0
Seems that changing Action 0 Down to Action 1 Up has cured the problem, if anybody else experiences it.
Erel B4X founder Staff member Licensed User Longtime User Feb 11, 2013 #3 Note that it is better to use Activity.ACTION_DOWN (0), ACTION_UP (1) or ACTION_MOVE (2). Upvote 0
E enonod Well-Known Member Licensed User Longtime User Feb 12, 2013 #4 Thank you for that advice Erel. Unfortunately what I thought was a solution was not. I need help here. Whatever code runs as a result of the Touch runs multiple times, randomly, and is definitely due to recalling the Touch event due to either finger bounce or something. I need a way to lock the Touch event until it is again required or something. Can you help please? Upvote 0
Thank you for that advice Erel. Unfortunately what I thought was a solution was not. I need help here. Whatever code runs as a result of the Touch runs multiple times, randomly, and is definitely due to recalling the Touch event due to either finger bounce or something. I need a way to lock the Touch event until it is again required or something. Can you help please?
Erel B4X founder Staff member Licensed User Longtime User Feb 12, 2013 #5 You can add a global flag variable named IgnoreEvent. Set it to True in the Touch event: Code: Copy Sub pnl_Touch(...) If IgnoreEvent Then Return IgnoreEvent = True ... Later when you want to process new events you should set it to false. Upvote 0
You can add a global flag variable named IgnoreEvent. Set it to True in the Touch event: Code: Copy Sub pnl_Touch(...) If IgnoreEvent Then Return IgnoreEvent = True ... Later when you want to process new events you should set it to false.
E enonod Well-Known Member Licensed User Longtime User Feb 12, 2013 #6 Thank you Erel, and I apologise because it should have been obvious to me. I think I was blinded by the fact that this was an event, which of course makes no difference. Upvote 0
Thank you Erel, and I apologise because it should have been obvious to me. I think I was blinded by the fact that this was an event, which of course makes no difference.