B4J Question Double Clicking a Button

Sandman

Expert
Licensed User
Longtime User
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

tsteward

Well-Known Member
Licensed User
Longtime User
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?
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

tsteward

Well-Known Member
Licensed User
Longtime User
B4X:
Private Sub Button1_MouseClicked (EventData As MouseEvent)
    If EventData.ClickCount = 2 Then
        Log("double click")
    End If
End Sub
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

Star-Dust

Expert
Licensed User
Longtime User
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
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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…