Restored from previous forum. Originally posted by PB.
This is a bit messy, but works. Only downside is that the single click takes a
moment to react, but hey, that's a small price to pay for achieving the goal.
Code: Select all
If OpenWindow(0, 200, 200, 200, 100, "Test", #PB_Window_SystemMenu)
ButtonGadget(1, 50, 20, 80, 50, "click me!")
Repeat
ev = WaitWindowEvent()
If ev = #PB_Event_Gadget
start = GetTickCount_() ;Note time of first click.
GetAsyncKeyState_(#VK_LBUTTON) ;Clear left mouse buffer.
Repeat : Until GetAsyncKeyState_(#VK_LBUTTON) <> 0 Or
GetTickCount_() - start > GetDoubleClickTime_()
If GetTickCount_() - start > GetDoubleClickTime_() ;Timed out!
MessageRequester("info", "single click")
Else
MessageRequester("info", "double click")
EndIf
EndIf
Until ev = #PB_Event_CloseWindow
EndIf