SysTray events slow to respond?

Just starting out? Need help? Post your questions and find answers here.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

SysTray events slow to respond?

Post by Dude »

When I run this code, and I click the systray icon with the left mouse button twice in a row (not too fast, but not too slow either), then only the FIRST click responds. If I click much slower, then ALL clicks respond. Is there some sort of internal timeout?

How can I make it respond to one click every half second (or every quarter second)?

The computer should never be slower than the user... :twisted:

Code: Select all

If OpenWindow(0, 100, 150, 300, 100, "PureBasic - SysTray Example", #PB_Window_SystemMenu)

  AddSysTrayIcon(1, WindowID(0), LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/Drive.bmp"))

  Repeat

    Event = WaitWindowEvent()

    If Event = #PB_Event_SysTray

      If EventType() = #PB_EventType_LeftClick
        Debug "left"
      EndIf

    EndIf

  Until Event = #PB_Event_CloseWindow

EndIf
fryquez
Enthusiast
Enthusiast
Posts: 369
Joined: Mon Dec 21, 2015 8:12 pm

Re: SysTray events slow to respond?

Post by fryquez »

If you are fast enough, than you need to check for #PB_EventType_LeftDoubleClick.

Code: Select all

If OpenWindow(0, 100, 150, 300, 100, "PureBasic - SysTray Example", #PB_Window_SystemMenu)

  AddSysTrayIcon(1, WindowID(0), LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/Drive.bmp"))

  Repeat

    Event = WaitWindowEvent()

    If Event = #PB_Event_SysTray

      If EventType() = #PB_EventType_LeftClick
        Debug "left"
      EndIf
      
      If EventType() = #PB_EventType_LeftDoubleClick
        Debug "double click left"
      EndIf
      
    EndIf

  Until Event = #PB_Event_CloseWindow

EndIf
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: SysTray events slow to respond?

Post by Dude »

Of course! (Slaps forehead). :oops: I forgot it had to check for that. Thanks!
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: SysTray events slow to respond?

Post by Mistrel »

I always find it interesting when people refer to the Taskbar Notification Area as the "system tray". I know that this is what PureBasic calls it but this is technically an oversight.

https://blogs.msdn.microsoft.com/oldnew ... 0/?p=42583
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: SysTray events slow to respond?

Post by Dude »

Mistrel wrote:I always find it interesting when people refer to the Taskbar Notification Area as the "system tray". I know that this is what PureBasic calls it but this is technically an oversight.
Not an oversight. It was originally (and still in October 2016) referred to as the "system tray" by Microsoft, and therefore people call it that:

(1) The official Windows API class name for it is "Shell_TrayWnd".
(2) Click "Start" and search for "tray". This is the result on Windows 7.
(3) Microsoft says the Notification Area is "historically known as the system tray" (source / image).
(4) Microsoft has a "System Tray" example where they say the Notification Area is "commonly called the system tray" (source / image).
(5) Microsoft's support page for "SndVol32" still refers to the "system-tray notification area" as of October 2016 (source / image).

I think the evidences above speak for themselves. ;) That single blogger is wrong and just trying to alter history.
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: SysTray events slow to respond?

Post by Dude »

The whole "systray vs notification area" debate reminds me of this:

https://youtu.be/sTz4I_hPm78

Microsoft called it systray, I'mma call it systray. ;)
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: SysTray events slow to respond?

Post by Mistrel »

The blog post I linked to is written by Raymon Chen who has been with Microsoft for almost 30 years and is an authority on this bit of history:
I think the reason people started calling it the "system tray" is that on Win95 there was a program called "systray.exe" that displayed some icons in the notification area: volume control, PCMCIA (as it was then called) status, battery meter. If you killed systray.exe, you lost those notification icons. So people thought, "Ah, systray must be the component that manages those icons, and I bet its name is 'system tray'." Thus began the misconception that we have been trying to eradicate for over eight years...
Your citations are much more recent and is simply a result of this misinformation continuing to propagate.
The SndVol32 program is represented as a speaker icon that appears in the system-tray notification area the taskbar ...
The system-tray is part of systray.exe which draws a particular group of icons which reside within the notification area. The notification area itself it not called the system tray.

Again:
This class supports using icons in the Taskbar Notification Area, which is commonly known as the System Tray ...
It is called the "Taskbar Notification Area" and, while more commonly known as the system try, is not its actual name.
Post Reply