The ToolTip function sometimes displays the text at the top of the screen incorrectly Topic is solved

Report problems with documented functionality
ZhuangQu
Posts: 33
Joined: 06 Feb 2022, 20:54

The ToolTip function sometimes displays the text at the top of the screen incorrectly

06 Feb 2022, 21:24

My system version is Windows 11 21H2 22000.469 and the AHK version is v2.0 beta.3.
When using the ToolTip function, we expect a piece of text to appear on the screen. If the area of the text goes beyond the edge of the screen, we expect it to be automatically corrected so that the text is just inside the screen. I have found that this position correction is correct horizontally and incorrect vertically. If the text goes beyond the lower edge of the screen, it will appear at the top of the screen.
As an example, run the code:

Code: Select all

ToolTip(my_string, x, y)
1.png
1.png (413.03 KiB) Viewed 3685 times
When x=1400, y=900, as shown in the 1.png, the text is inside the screen, which is OK.
2.png
2.png (423.61 KiB) Viewed 3685 times
When x=2000, y=900, as shown in the 2.png, the text is beyond the right edge of the screen and is corrected to be close to the right edge, which is OK.
3.png
3.png (455.12 KiB) Viewed 3685 times
When x=1400, y=950, as shown in the 3.png, the text is beyond the bottom edge of the screen and is corrected to be close to the top edge, which is a bug.
ZhuangQu
Posts: 33
Joined: 06 Feb 2022, 20:54

Re: The ToolTip function sometimes displays the text at the top of the screen incorrectly

07 Feb 2022, 21:27

At https://lexikos.github.io/v2/docs/commands/ToolTip.htm, the documentation says "If the X & Y coordinates would cause the tooltip to run off screen, it is repositioned to be entirely visible". This repositioning is wrong at the bottom of the screen, I guess that the height of taskbar causes it.
joefiesta
Posts: 498
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Re: The ToolTip function sometimes displays the text at the top of the screen incorrectly

08 Feb 2022, 15:35

where's your code you want that I run?
ZhuangQu
Posts: 33
Joined: 06 Feb 2022, 20:54

Re: The ToolTip function sometimes displays the text at the top of the screen incorrectly

08 Feb 2022, 20:28

joefiesta wrote:
08 Feb 2022, 15:35
where's your code you want that I run?

Code: Select all

    my_string := "
(
The text area extends beyond the lower edge of the screen.
We expect it to be displayed at the bottom of the screen after repositioned,
but it is incorrectly repositioned to the top of the screen.
)"
    ToolTip(my_string, 0, A_ScreenHeight - 1)
joefiesta
Posts: 498
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Re: The ToolTip function sometimes displays the text at the top of the screen incorrectly

09 Feb 2022, 12:30

@Zhangqu: duh... you never mention it fails in V2 only!!! but, thanks for the clarified example.
ZhuangQu
Posts: 33
Joined: 06 Feb 2022, 20:54

Re: The ToolTip function sometimes displays the text at the top of the screen incorrectly

09 Feb 2022, 18:00

joefiesta wrote:
09 Feb 2022, 12:30
@Zhangqu: duh... you never mention it fails in V2 only!!! but, thanks for the clarified example.
Sorry, I'm a pure v2 user and don't have v1 on my computer. My guess is that this bug is related to the taskbar. In my win11, the height of the taskbar is half of A_ScreenDPI, which makes the screen height available for ToolTip actually only A_ScreenHeight - A_ScreenDPI / 2, not A_ScreenHeight.
lexikos
Posts: 9629
Joined: 30 Sep 2013, 04:07
Contact:

Re: The ToolTip function sometimes displays the text at the top of the screen incorrectly

23 Apr 2022, 03:36

This is due to a change in Windows, preventing tooltips from being displayed overlapping the taskbar, unless it is set to auto-hide. AutoHotkey specifically avoids positioning the tooltip outside the screen, and this works well enough up to Windows 7 (and maybe 8 or 8.1). On Windows 10 and 11, when AutoHotkey requests a position that would overlap with the taskbar, the tooltip control ignores it and instead positions itself at the top of the screen.

It can be fixed, although I will have to consider whether to allow the tooltip to overlap with the taskbar on systems which allow it, or to work around the restriction (if possible) and allow tooltips to overlap the taskbar on all systems.

It applies to both v1 and v2.
User avatar
smrt1
Posts: 30
Joined: 27 Mar 2022, 04:47

Re: The ToolTip function sometimes displays the text at the top of the screen incorrectly

23 Apr 2022, 18:00

lexikos wrote:
23 Apr 2022, 03:36
It can be fixed, although I will have to consider whether to allow the tooltip to overlap with the taskbar on systems which allow it, or to work around the restriction (if possible) and allow tooltips to overlap the taskbar on all systems.
My opinion : it would be better to restrict the tooltip display to the workerea.
AlFlo
Posts: 350
Joined: 29 Nov 2021, 21:46

Re: The ToolTip function sometimes displays the text at the top of the screen incorrectly

20 Jan 2023, 11:57

smrt1 wrote:
23 Apr 2022, 18:00
lexikos wrote:
23 Apr 2022, 03:36
It can be fixed, although I will have to consider whether to allow the tooltip to overlap with the taskbar on systems which allow it, or to work around the restriction (if possible) and allow tooltips to overlap the taskbar on all systems.
My opinion : it would be better to restrict the tooltip display to the workerea.
smrt1, just curious ... why did you think restricting tooltip to the work area is better? For example, I would find a a tooltip in the taskbar telling me whether my caps lock is on or off to be helpful.
nelvin08
Posts: 97
Joined: 27 Mar 2022, 23:13

Re: The ToolTip function sometimes displays the text at the top of the screen incorrectly

23 Sep 2023, 23:39

lexikos wrote:
04 Jun 2022, 22:09
This was fixed by v1.1.34.00.
By fixed, you mean we can now have the tooltip above the taskbar? It still doesn't seem to be the case now though.

I need this functionality too although I know GUI can do this better but some people prefer tooltip. Thank you
lexikos
Posts: 9629
Joined: 30 Sep 2013, 04:07
Contact:

Re: The ToolTip function sometimes displays the text at the top of the screen incorrectly

24 Sep 2023, 00:22

"The ToolTip function sometimes displays the text at the top of the screen incorrectly" was fixed.

It was fixed by constraining the tooltip to the portion of the screen in which the system actually permits it to be.

If you want a tooltip outside of the work area, you can move it with WinMove, but updating the tooltip may cause the system to reposition it. There are no workarounds for this limitation which are reliable and free of side-effects (not counting alternative GUIs).

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 11 guests