tsteward Well-Known Member Licensed User Longtime User Jul 21, 2021 #1 Is there a way to detect double clicking or long press on a button created as B4XView?
Sandman Expert Licensed User Longtime User Jul 21, 2021 #2 Double click: just measure the time between the clicks. If it's under your threshold, it's a double click. (Don't know about long press, sorry.) I'm curious, why do you want the user to double click buttons? Upvote 0
Double click: just measure the time between the clicks. If it's under your threshold, it's a double click. (Don't know about long press, sorry.) I'm curious, why do you want the user to double click buttons?
tsteward Well-Known Member Licensed User Longtime User Jul 21, 2021 #3 Sandman said: Double click: just measure the time between the clicks. If it's under your threshold, it's a double click. (Don't know about long press, sorry.) I'm curious, why do you want the user to double click buttons? Click to expand... Well long click would be better, double click was just an option if I can't detect long click. I want this because my android app performs different functions depending on button press or button long press. I want my B4J version of the app to behave similarly. Upvote 0
Sandman said: Double click: just measure the time between the clicks. If it's under your threshold, it's a double click. (Don't know about long press, sorry.) I'm curious, why do you want the user to double click buttons? Click to expand... Well long click would be better, double click was just an option if I can't detect long click. I want this because my android app performs different functions depending on button press or button long press. I want my B4J version of the app to behave similarly.
Andrew (Digitwell) Well-Known Member Licensed User Longtime User Jul 21, 2021 #4 You could measure the time between mousepressed and mousereleased events for the button. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jul 21, 2021 #5 Code: Private Sub Button1_MouseClicked (EventData As MouseEvent) If EventData.ClickCount = 2 Then Log("double click") End If End Sub Upvote 0
Code: Private Sub Button1_MouseClicked (EventData As MouseEvent) If EventData.ClickCount = 2 Then Log("double click") End If End Sub
tsteward Well-Known Member Licensed User Longtime User Jul 22, 2021 #6 Erel said: Code: Private Sub Button1_MouseClicked (EventData As MouseEvent) If EventData.ClickCount = 2 Then Log("double click") End If End Sub Click to expand... Clicking the button slowly works as a single click Double clicking fires as a single click then fires again as a double click. How can I supress this single click Upvote 0
Erel said: Code: Private Sub Button1_MouseClicked (EventData As MouseEvent) If EventData.ClickCount = 2 Then Log("double click") End If End Sub Click to expand... Clicking the button slowly works as a single click Double clicking fires as a single click then fires again as a double click. How can I supress this single click
Star-Dust Expert Licensed User Longtime User Jul 22, 2021 #7 tsteward said: Clicking the button slowly works as a single click Double clicking fires as a single click then fires again as a double click. How can I supress this single click Click to expand... It depends on the settings you have put on windows. You can set the interval between the first click and the second (slow or fast) from the control panel Or create a click counter yourself with a global variable that increments with each click. But in any case after a certain time it must reset otherwise you would have problems that it continues to count and distort the results ... (You may also have reported a double click with two clicks 10 minutes or an hour apart ... ) I do not recommend the latter solution Upvote 0
tsteward said: Clicking the button slowly works as a single click Double clicking fires as a single click then fires again as a double click. How can I supress this single click Click to expand... It depends on the settings you have put on windows. You can set the interval between the first click and the second (slow or fast) from the control panel Or create a click counter yourself with a global variable that increments with each click. But in any case after a certain time it must reset otherwise you would have problems that it continues to count and distort the results ... (You may also have reported a double click with two clicks 10 minutes or an hour apart ... ) I do not recommend the latter solution