WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: User_McUser on February 21, 2024, 01:07:41 PM

Title: Update a Systray icon tooltip in real time?
Post by: User_McUser on February 21, 2024, 01:07:41 PM
I am working on a script that runs in the system tray and on mouse-over shows the time left in a timer.

It works, but the value in the tooltip does not update while being displayed; that is to say, when I mouse over the tray icon it shows a tooltip with the seconds remaining, but as time passes the tooltip text does not change unless I mouse away and back over.

I'd like for the user to see the countdown happening in real time if they leave the pointer over the icon, if this is possible.
The code below is what I'm using right now.

Code (winbatch) Select
timeRemaining = 60

:timerLoop
TimeDelay(1)

timeRemaining -= 1
if timeRemaining < 1 then exit

theToolTip = StrCat(timeRemaining, " sec remaining.")
IntControl(1007,4,1,theToolTip,"")

Goto timerLoop


Thank you! :D
Title: Re: Update a Systray icon tooltip in real time?
Post by: td on February 21, 2024, 01:57:33 PM
I hate to say it, but it works for me after adding the necessary IntControl(1007, 1,... line to the top of your script. By "works for me" I mean it updates the text once per second when the mouse cursor is over the script's notification area icon. Of course, if you click on the icon the tip disappears, and you need to move the cursor off the icon and back over the icon to resume seeing the countdown.
Title: Re: Update a Systray icon tooltip in real time?
Post by: User_McUser on February 22, 2024, 06:45:04 AM
Interesting... 🤔 I wonder what's different about my systems that makes it not work for me; tried it on three different Windows 10 PCs.

While a tiny bit disappointing it's not the end of the world - I'll probably just change to "minutes remaining" and call it good enough. 👍

Thank you! 😊
Title: Re: Update a Systray icon tooltip in real time?
Post by: td on February 22, 2024, 07:42:56 AM
There are numerous taskbar settings in Windows 10/11 but it is difficult to determine which or if any of them are influencing the tooltip behavior. You would likely have to perform trial-and-error testing with no guarantee of success.
Title: Re: Update a Systray icon tooltip in real time?
Post by: td on February 23, 2024, 01:38:44 PM
I happened to be performing compatibility checks on an old version of Windows 10 (2022h2).  Your script does not update the text once per second when the mouse cursor is over the script's notification area icon on that version of Windows.  I guess the fix would be to upgrade to Windows 11...
Title: Re: Update a Systray icon tooltip in real time?
Post by: spl on February 23, 2024, 02:11:15 PM
Quote from: td on February 23, 2024, 01:38:44 PM
I happened to be performing compatibility checks on an old version of Windows 10 (2022h2).  Your script does not update the text once per second when the mouse cursor is over the script's notification area icon on that version of Windows.  I guess the fix would be to upgrade to Windows 11...

which according to Microsoft is underway, forcefully, for applicable PC's.
Title: Re: Update a Systray icon tooltip in real time?
Post by: td on February 26, 2024, 08:21:39 AM
Yes, that appears to be the case. Fortunately, we have a Windows 10 VM that is configured to be incompatible with Windows 11. We need to keep old OS's around for testing purposes and verifying user issues.