ListView renders empty in Tab3 non-first tabs (Icon, IconSmall and Tile modes)

Report problems with documented functionality
User avatar
RadRussianRus
Posts: 2
Joined: 05 Aug 2021, 18:34
Contact:

ListView renders empty in Tab3 non-first tabs (Icon, IconSmall and Tile modes)

05 Aug 2021, 19:28

Affected version: 1.1.33.09

Code: Select all

; Bug demonstration: ListView doesn't show items
; with Icon, IconSmall and Tile view modes for list views on
; tabs in Tab3 mode other than first or pre-selected if view mode specified
; in Gui, Add, ListView options

; Preparing icons
ImgListSmall := IL_Create(1, 1, 0)
IL_Add(ImgListSmall, "C:\Windows\system32\shell32.dll")

ImgListBig := IL_Create(1, 1, 1)
IL_Add(ImgListBig, "C:\Windows\system32\shell32.dll")

; Preparing tab widget with pre-selected Tab 2
Gui, Add, Tab3,, Icon View|Icon View (default)||Small Icon View|List View|Tile View|Report View|Icon View (workaround)

; Icon View tab will render as empty
; Multiple selection by mouse will show the elements
Gui, Tab, 1
Gui, Add, ListView, +Icon, Name
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "First item")

; Icon View (default) tab will work fine since it's drawn first
Gui, Tab, 2
Gui, Add, ListView, +Icon, Name
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "Second item")

; Small Icon View tab will render as empty
; Multiple selection by mouse will show the elements
Gui, Tab, 3
Gui, Add, ListView, +IconSmall, Name
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "Third item")

; List View tab will work fine (unaffected)
Gui, Tab, 4
Gui, Add, ListView, +List, Name
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "Fourth item")

; Tile View tab will render as empty
; Multiple selection by mouse will show the elements
Gui, Tab, 5
Gui, Add, ListView, +Tile, Name
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "Fifth item")

; Report View tab will work fine (unaffected)
Gui, Tab, 6
Gui, Add, ListView, +Report, Name
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "Sixth item")

; Icon View (workaround) tab will work fine
; Note that we're using +Report, not +Icon
; and defined a variable for this control
Gui, Tab, 7
Gui, Add, ListView, vIconViewWorkaround +Report, Name
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "Seventh item")

; Workaround itself
; View mode must be different than in Gui, Add, ListView options,
; otherwise it won't work, but you can safely call GuiControl
; before Gui, Show
GuiControl, +Icon, IconViewWorkaround

Gui, Show
iPhilip
Posts: 822
Joined: 02 Oct 2013, 12:21

Re: ListView renders empty in Tab3 non-first tabs (Icon, IconSmall and Tile modes)

17 Aug 2021, 17:40

Hi @RadRussianRus,

The ListViews will show the icons if you force them to be redrawn, e.g.

Code: Select all

Gui, Add, ListView, +Icon vLV1, Name
GuiControl, -Redraw, LV1  ; <---
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "First item")
GuiControl, +Redraw, LV1  ; <---
Here is the code you posted with the above solution embedded in each of the ListViews where the icons are not rendered:

Code: Select all

; Solution to: ListView doesn't show items
; with Icon, IconSmall and Tile view modes for list views on
; tabs in Tab3 mode other than first or pre-selected if view mode specified
; in Gui, Add, ListView options

; Preparing icons
ImgListSmall := IL_Create(1, 1, 0)
IL_Add(ImgListSmall, "C:\Windows\system32\shell32.dll")

ImgListBig := IL_Create(1, 1, 1)
IL_Add(ImgListBig, "C:\Windows\system32\shell32.dll")

; Preparing tab widget with pre-selected Tab 2
Gui, Add, Tab3,, Icon View|Icon View (default)||Small Icon View|List View|Tile View|Report View|Icon View (workaround)

; Icon View tab will render as empty (solved)
; Multiple selection by mouse will show the elements
Gui, Tab, 1
Gui, Add, ListView, +Icon vLV1, Name
GuiControl, -Redraw, LV1
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "First item")
GuiControl, +Redraw, LV1

; Icon View (default) tab will work fine since it's drawn first (but not if it's not - solved)
Gui, Tab, 2
Gui, Add, ListView, +Icon vLV2, Name
GuiControl, -Redraw, LV2
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "Second item")
GuiControl, +Redraw, LV2

; Small Icon View tab will render as empty (solved)
; Multiple selection by mouse will show the elements
Gui, Tab, 3
Gui, Add, ListView, +IconSmall vLV3, Name
GuiControl, -Redraw, LV3
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "Third item")
GuiControl, +Redraw, LV3

; List View tab will work fine (unaffected)
Gui, Tab, 4
Gui, Add, ListView, +List, Name
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "Fourth item")

; Tile View tab will render as empty (solved)
; Multiple selection by mouse will show the elements
Gui, Tab, 5
Gui, Add, ListView, +Tile vLV5, Name
GuiControl, -Redraw, LV5
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "Fifth item")
GuiControl, +Redraw, LV5

; Report View tab will work fine (unaffected)
Gui, Tab, 6
Gui, Add, ListView, +Report, Name
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "Sixth item")

; Icon View (workaround) tab will work fine
; Note that we're using +Report, not +Icon
; and defined a variable for this control
Gui, Tab, 7
Gui, Add, ListView, vIconViewWorkaround +Report, Name
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
LV_Add("Icon1", "Seventh item")

; Workaround itself
; View mode must be different than in Gui, Add, ListView options,
; otherwise it won't work, but you can safely call GuiControl
; before Gui, Show
GuiControl, +Icon, IconViewWorkaround

Gui, Show
I hope this helps.
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)
User avatar
RadRussianRus
Posts: 2
Joined: 05 Aug 2021, 18:34
Contact:

Re: ListView renders empty in Tab3 non-first tabs (Icon, IconSmall and Tile modes)

18 Aug 2021, 10:09

@iPhilip, thanks for another workaround. I guess it's needed to call -Redraw before any LV_Add, since this code

Code: Select all

Gui, Add, ListView, +Icon vLV1, Name
LV_SetImageList(ImgListSmall)
LV_SetImageList(ImgListBig)
GuiControl, -Redraw, LV1
LV_Add("Icon1", "First item")
GuiControl, +Redraw, LV1
works fine aswell.

Kinda strange that it happens only in three view modes though.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 50 guests