Tooltips for truncated items in ListView are not correctly updated when ActiveX control is added

Report problems with documented functionality
dipahk
Posts: 18
Joined: 15 Apr 2016, 16:01
Location: Germany

Tooltips for truncated items in ListView are not correctly updated when ActiveX control is added

21 Mar 2024, 11:45

As described in this post viewtopic.php?f=82&t=127587 there seems to be a bug in updating tooltips of truncated items of a listview. The bug only appears when an ActiveX control is added in addition to the listview control and when running the ahk script on Windows 11. In Windows 10 the tooltips are correctly updated.

The description of the bug is as follows:

In a gui comprising a listview control an item is truncated when its length is greater than the width of the listview column comprising the item.

By adding the option +LV0x400 to the listview, a tooltip comprising the complete item text is shown when hovering with the mouse over the truncated item.

Usually the tooltip for the item under the mouse is always correctly updated when I hover the mouse from one item to another item.

However, when I add an ActiveX control to the same gui, the tooltip is not always correctly updated when moving the mouse. Whith an added ActiveX control this only works correctly when hovering between the items of column 1. In the other columns the tooltip is only updated when I move the mouse from a first item to an item located above the first item. But when I move the mouse from a first item to a second item located below the first item the tooltip for the first item is maintained rather than showing the tooltip for the second item.

You should be able to reproduce this behavior with the following code:

Code: Select all

myGui := Gui()
myGui.OnEvent("Close", GuiClose)

mylistview := myGui.Add("ListView", "w450 h400 +LV0x400 +LV0x10000", ["A", "B", "C", "D"])
mylistview.ModifyCol(1, 100)
mylistview.ModifyCol(2, 100)
mylistview.ModifyCol(3, 100)
mylistview.ModifyCol(4, 100)

myActiveX := myGui.Add("ActiveX", "x+10 w850 h400", "Shell.Explorer").Value

mylistview.Add("", "Col A Row 111111111111111111111111111", "Col B Row 111111111111111111111111111", "Col C Row 111111111111111111111111111", "Col D Row 111111111111111111111111111")
mylistview.Add("", "Col A Row 222222222222222222222222222", "Col B Row 222222222222222222222222222", "Col C Row 222222222222222222222222222", "Col D Row 222222222222222222222222222")
mylistview.Add("", "Col A Row 333333333333333333333333333", "Col B Row 333333333333333333333333333", "Col C Row 333333333333333333333333333", "Col D Row 333333333333333333333333333")
mylistview.Add("", "Col A Row 444444444444444444444444444", "Col B Row 444444444444444444444444444", "Col C Row 444444444444444444444444444", "Col D Row 444444444444444444444444444")

myGui.Show("autosize Center")

Return


GuiClose(*)
{
	ExitApp()
}
Simply delete the "myActiveX" line and everything works as it should. But when the "ActiveX" line is included, the tooltips are no longer updated correctly as explained above.

If I position my mouse over the first row of column D, a tooltip with "Col D Row 111111111111111111111111111" appears.
When I then move the mouse for example to the last row of column D the original tooltip "Col D Row 111111111111111111111111111" remains shown for some time before it disappears. However, it should immediately show a new tooltip with "Col D Row 444444444444444444444444444" when the mouse reaches the last row of column D.

If I make the same mouse movements in column A (from the first row to the last row) or if I make the movement from the last row of column D to the first row of column D the tooldip is correctly updated.

If I remove the "ActiveX" line from the code the tooltip is also correctly updated when the mouse is moved from the first row of column D to the last row of column D.

The script run flawlessly running Windows 10 22H2, AHK 2.0.11
The bug was confirmed on several computers running Windows 11 23H2 and AHK 2.0.11. It also was confirmed that the same problem exists using a v1 version of the script.
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: Tooltips for truncated items in ListView are not correctly updated when ActiveX control is added

21 Mar 2024, 22:49

There are several reasons I would consider this to be "not a bug", or otherwise irrelevant to me (as the developer of AutoHotkey):
  • As far as I am aware, displaying tooltips over items is not a documented feature of AutoHotkey. Even the documentation for the style number (which is copied from Microsoft's documentation for your convenience) does not say that it will enable tooltips to be displayed, nor does it say how they will be positioned or when they will be updated.
  • For the actual implementation of the ListView tooltips, AutoHotkey merely sets the ListView extended style as requested by your script (without knowing what meaning the number 0x400 has), and the rest is handled by the system. AutoHotkey does not track the mouse, handle tooltip notifications, or otherwise do anything with the ListView's tooltips.
  • AutoHotkey "creates" the ActiveX control by indirectly invoking a system library, without ever even knowing what type of control is being created or which library implements it. Working around side effects of an ActiveX control is outside the scope of the built-in functionality.
  • The same AutoHotkey versions, code and controls work correctly on older Windows versions, indicating that if this was a bug, it would be a Windows bug.

If you must ask if you should file a bug report, you should give others more than just a few hours to reply before going ahead and doing it.

"ActiveX control" is not synonymous with "Internet Explorer WebBrowser control". This issue is only present with the Internet Explorer-based WebBrowser control. Other controls such as "msinkaut.InkPicture" do not trigger this issue. Internet Explorer is incredibly outdated, and is well and truly unsupported on Windows 11. Working around issues with Internet Explorer specific to Windows 11 is likely to be an exercise in futility.

If a workaround is possible, it should be possible purely in script. If someone can find and demonstrate a low-cost workaround, I would consider implementing a built-in equivalent.
dipahk
Posts: 18
Joined: 15 Apr 2016, 16:01
Location: Germany

Re: Tooltips for truncated items in ListView are not correctly updated when ActiveX control is added

22 Mar 2024, 06:37

@Lexicos Many thanks for your detailed explanation.

I did not know that the listview tooltip is not explilcitely generated by AutoHotkey but by Windows itself. From your explanation I agree that the reported problem must be considered as a bug in Windows 11 rather than in AutoHotkey. Sorry that I did file a bug report before this question was clarified.

I could imaging that as workaround I could try to disable the ListView extended style and to use the AutoHotkey tooltip command to display the complete text of a truncated listview item. At the moment I struggle to find out

1. how to retrieve the row and column number of the listview item which is currently under the mouse, and
2. how to detect if the text of the current listview item is truncated (only in this case I want to display a tooltip with the complete item text).

Regarding item 2, is there any way to get the info that the current item is truncated? If not, is there a way to retrieve the width of the (complete) current listview item? If I can get the item width I could compare it to the current width of the listview column to detect if the item is truncated or not.

Finally, in my specific case I use the ActiveX control (Shell.Explorer) to preview the contents of a file which is selected in the listview within the ActiveX control of the AutoHotkey gui. Since the Shell.Explorer ActiveX control is able to preview a lot of different file formats this was a handy way to create such a preview pane within an AutoHotkey gui for a lot of different file formats.

Is there a better way to create a file preview pane within an AutoHotkey gui? Is it for example possible to use the file preview capability of (current) Windows Explorer instead of using the outdated Internet Explorer WebBrowser control?

I would very much appreciate if could get any hints regarding item 1. and 2. and regarding the file preview possibilities.
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: Tooltips for truncated items in ListView are not correctly updated when ActiveX control is added

22 Mar 2024, 17:28

Your questions are better asked in the original topic, not the Bug Report forum. I left this topic open for reports or discussion of a possible workaround.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 61 guests