Sorry if this is a dumb question and if I missed this, but I can't seem to find a solution. My question sound as:
How can I forcefully clear the event queue ? I'm getting a lot of mouse click events in the main loop when I click on an icon multiple times. That's ok, but I need only one. Only the first event. Here is minimal code that demonstrates the problem:
Code: Select all
win_nr = OpenWindow(#PB_Any, 0, 0, 400, 200, "test-window", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
If win_nr = 0 : End : EndIf
hIcon = ExtractIcon_(0, "imageres.dll", 100)
AddSysTrayIcon(1, WindowID(win_nr), hIcon)
msgbox_title.s = "Attention !"
msgbox_body.s = "blah-blah-blah..."
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_SysTray
Select EventType()
Case #PB_EventType_LeftClick, #PB_EventType_LeftDoubleClick
Debug "LeftClick or LeftDoubleClick was detected on SysTray"
If FindWindow_(0, msgbox_title) = 0
MessageRequester(msgbox_title, msgbox_body, #MB_SYSTEMMODAL)
Else ; do nothing !
Debug "msgbox already opened"
EndIf
EndSelect
Case #PB_Event_CloseWindow
DestroyIcon_(hIcon)
Break
EndSelect
ForEver

So...
How to clear the event queue from mouse clicks

Thank you in advance !