***Edit to remove code****
I'll repost when I debug it properly

***Edit to replace code*** There was no bug, it was me

Code: Select all
;...New icon size
iconW = 100
iconH = 100
;...Create some images for this example
zeroImg = CreateImage(0, iconW, iconH)
StartDrawing(ImageOutput(0))
Box(0, 0, iconW, iconH, RGB(0, 0, 0))
StopDrawing()
greenImg = CreateImage(1, iconW, iconH)
StartDrawing(ImageOutput(1))
Box(0, 0, iconW, iconH, RGB(0, 255, 0))
StopDrawing()
blueImg = CreateImage(2, iconW, iconH)
StartDrawing(ImageOutput(2))
Box(0, 0, iconW, iconH, RGB(0, 0, 255))
StopDrawing()
redImg = CreateImage(3, iconW, iconH)
StartDrawing(ImageOutput(3))
Box(0, 0, iconW, iconH, RGB(255, 0, 0))
StopDrawing()
;...Create our newly sized image list
newIL = ImageList_Create_(iconW, iconH, #ILC_COLOR32, 0, 20)
;...Add our images
ImageList_Add_(newIL, ImageID(0), 0)
ImageList_Add_(newIL, ImageID(1), 0)
ImageList_Add_(newIL, ImageID(2), 0)
ImageList_Add_(newIL, ImageID(3), 0)
If OpenWindow(0, 0, 0, 700, 500, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
ListIconGadget(0, 10, 10, 680, 480, "", 200)
ChangeListIconGadgetDisplay(0, #PB_ListIcon_LargeIcon)
For i = 0 To 3
item$ = "Item " + Str(i)
AddGadgetItem(0 , i, item$, greenImg)
Next i
FreeImage(1)
For i = 4 To 7
item$ = "Item " + Str(i)
AddGadgetItem(0 , i, item$, blueImg)
Next i
FreeImage(2)
For i = 8 To 11
item$ = "Item " + Str(i)
AddGadgetItem(0 , i, item$, redImg)
Next i
FreeImage(3)
FreeImage(0)
;...Get handle to current ListIconGadget normal image list
oldIL = SendMessage_(GadgetID(0), #LVM_GETIMAGELIST, #LVSIL_NORMAL, 0)
;...Replace the old image list with our new one
SendMessage_(GadgetID(0), #LVM_SETIMAGELIST, #LVSIL_NORMAL, newIL)
;...Destroy the old image list
ImageList_Destroy_(oldIL)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
End