Page 2 of 2

Posted: Fri Apr 03, 2009 1:29 pm
by srod
I agree - or keep two copies of the ListIcon, one with and one without the images. A bit of overkill though! :)

Posted: Fri Apr 03, 2009 1:34 pm
by Fluid Byte
Nah, it's alright unless you got a really big amount of data. :)

Posted: Sun Apr 12, 2009 6:35 am
by RASHAD
OpenWindow(0,0,0,400,300,"Test 2",#PB_Window_SystemMenu | 1)
hwndLV = ListIconGadget(0,10,10,380,250,"Column 1",120,#PB_ListIcon_FullRowSelect)
AddGadgetColumn(0,1,"Column 2",120)
ButtonGadget(1,10,265,120,25,"Remove ImageList")
ButtonGadget(2,150,265,120,25,"Set ImageList")

LoadImage(0,#PB_Compiler_Home + "Examples\Sources\Data\CdPlayer.ico")
himlIcons = ImageList_Create_(16,16,#ILC_COLOR32 | #ILC_MASK,0,0)
himIcons = ImageList_Create_(16,16,#ILC_COLOR32 | #ILC_MASK,0,0)
ImageList_AddIcon_(himlIcons,ImageID(0))
ImageList_AddIcon_(himIcons,ImageID(0))
SendMessage_(GadgetID(0),#LVM_SETIMAGELIST,#LVSIL_SMALL,himlIcons)

For i=1 To 100
AddGadgetItem(0,-1,"Lorem Ipsum" + Chr(10) + Str(i))
Next

Repeat

Select WaitWindowEvent()
Case #PB_Event_CloseWindow : End
Case #PB_Event_Gadget
Select EventGadget()
Case 1
ImageList_SetIconSize_(himlIcons,0,16)
SendMessage_(GadgetID(0),#LVM_SETIMAGELIST,#LVSIL_SMALL,himlIcons)

Case 2
SendMessage_(GadgetID(0),#LVM_SETIMAGELIST,#LVSIL_SMALL,himIcons)
EndSelect
EndSelect
ForEver

Posted: Sun Apr 12, 2009 11:01 am
by Fluid Byte
That actually works! :o

PS: RASHAD, code you please use code tags?

Posted: Sun Apr 12, 2009 11:19 am
by srod
Very simple! :) Nice one. Works fine on Vista with or without themes.

Posted: Mon Apr 13, 2009 4:53 pm
by netmaestro
Seems an effective implementation of Sparkie's first idea, good work.

Posted: Mon Apr 13, 2009 6:45 pm
by RASHAD

Code: Select all

OpenWindow(0,0,0,400,300,"Test 1",#PB_Window_SystemMenu | 1)
hwndLV = ListIconGadget(0,10,10,380,250,"Column 1",120,#PB_ListIcon_FullRowSelect)
AddGadgetColumn(0,1,"Column 2",120)
ButtonGadget(1,10,265,120,25,"Remove ImageList")
ButtonGadget(2,150,265,120,25,"Set ImageList")

LoadImage(0,#PB_Compiler_Home + "Examples\Sources\Data\CdPlayer.ico")
himlIcons = ImageList_Create_(16,16,#ILC_COLOR32 | #ILC_MASK,0,0)
ImageList_AddIcon_(himlIcons,ImageID(0))
SendMessage_(GadgetID(0),#LVM_SETIMAGELIST,#LVSIL_SMALL,himlIcons)

For i=1 To 100
    AddGadgetItem(0,-1,"Lorem Ipsum" + Chr(10) + Str(i))
Next

Repeat

   Select WaitWindowEvent()
      Case #PB_Event_CloseWindow : End
      Case #PB_Event_Gadget
      Select EventGadget()
         Case 1         
          ImageList_SetIconSize_(himlIcons,1,16)
          SendMessage_(GadgetID(0),#LVM_SETIMAGELIST,#LVSIL_SMALL,himlIcons)
                   
         Case 2
          ImageList_SetIconSize_(himlIcons,16,16)
          ImageList_AddIcon_(himlIcons,ImageID(0))
          SendMessage_(GadgetID(0),#LVM_SETIMAGELIST,#LVSIL_SMALL,himlIcons)
      EndSelect
   EndSelect
ForEver
No second ImageList but 1 pixel at the left

RASHAD

Posted: Mon Apr 13, 2009 7:56 pm
by Fluid Byte
RASHAD wrote:No second ImageList but 1 pixel at the left
You can set the width to NULL so it's pixel-perfect :wink:

Posted: Mon Apr 13, 2009 8:33 pm
by RASHAD
No it is not the same
It gives me grayed Icons

agreed?
RASHAD