Jump to content
Sign in to follow this  
MISIIM

ListViewItem icon

Recommended Posts

MISIIM

I have a listbox and the icons won't appear. As a test I modified the example from the help file and it appears to not work there either. Is there a special style that has to be set?

Thank you.

#include <GUIConstants.au3>

GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF)  ; will change background color

$listview = GUICtrlCreateListView ("col1  |col2|col3  ",10,10,200,150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton ("Value?",75,170,70,20)
$item1=GUICtrlCreateListViewItem("item2|col22|col23",$listview)
GUICtrlSetImage($item1, @ScriptDir & "\folder.ico");
$item2=GUICtrlCreateListViewItem("item1|col12|col13",$listview)
$item3=GUICtrlCreateListViewItem("item3|col32|col33",$listview)
$input1=GUICtrlCreateInput("",20,200, 150)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)   ; to allow drag and dropping
GUISetState()
GUICtrlSetData($item2,"ITEM1")
GUICtrlSetData($item3,"||COL33")
GUICtrlDelete($item1)

Do
  $msg = GUIGetMsg ()
     
   Select
      Case $msg = $button
         MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)
      Case $msg = $listview
         MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview),2)
   EndSelect
Until $msg = $GUI_EVENT_CLOSE
Edited by MISIIM

Share this post


Link to post
Share on other sites
martin

I have a listbox and the icons won't appear. As a test I modified the example from the help file and it appears to not work there either. Is there a special style that has to be set?

Thank you.

#include <GUIConstants.au3>

GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF)  ; will change background color

$listview = GUICtrlCreateListView ("col1  |col2|col3  ",10,10,200,150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton ("Value?",75,170,70,20)
$item1=GUICtrlCreateListViewItem("item2|col22|col23",$listview)
GUICtrlSetImage($item1, @ScriptDir & "\folder.ico");
$item2=GUICtrlCreateListViewItem("item1|col12|col13",$listview)
$item3=GUICtrlCreateListViewItem("item3|col32|col33",$listview)
$input1=GUICtrlCreateInput("",20,200, 150)
GUICtrlSetState(-1,$GUI_DROPACCEPTED)   ; to allow drag and dropping
GUISetState()
GUICtrlSetData($item2,"ITEM1")
GUICtrlSetData($item3,"||COL33")
GUICtrlDelete($item1)

Do
  $msg = GUIGetMsg ()
     
   Select
      Case $msg = $button
         MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview)),2)
      Case $msg = $listview
         MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview),2)
   EndSelect
Until $msg = $GUI_EVENT_CLOSE
I don't think GuiCtrlSetImage can be used for a listview item.

I think you need to include GUILISTVIEW.AU3 and use

_GuiCtrlListViewCreateImageList

Have a look at this example by elTorro

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Zedna

I don't think GuiCtrlSetImage can be used for a listview item.

I think you need to include GUILISTVIEW.AU3 and use

_GuiCtrlListViewCreateImageList

Have a look at this example by elTorro

GuiCtrlSetImage can be used for listview item.

Look at my LogView project in my signature.

Share this post


Link to post
Share on other sites
Zedna

LogView shows no icons for me..

Randall

1) look at screenshot log_view.png

2) look here - it's old project and with new Autoit versions (3.2) should be changed

GUICtrlSetImage(-1, @ScriptFullPath, 5)
due to changed Autoit icons logic. See HelpFile for GUICtrlSetImage()

Share this post


Link to post
Share on other sites
Zedna

Hi,

So you agree, it does not show icons using the commands you have used in that project; so why show it as an example that icons work!? - Not sure what you're saying here..

Best, Randall

In the time I was making that post it was working right with Autoit from that time.

But later Autoit GUICtrlSetImage icon numbering logic has changed so my script isn§t working now.

I made EDIT: section in that post with explanation after that.

I will update all my projects in my fileman area to be compatible with latest version Autoit sometimes in the future.

For now you can correct it yourself by my instructions.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.