Jump to content

_GUICtrlListView_AddItem icon bug?


davidkim
 Share

Recommended Posts

_GUICtrlListView_AddItem not insert icon want

how ?

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

_Main()

Func _Main()
    Local $hGui, $listview, $hImage
;~  Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)
 Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_DOUBLEBUFFER)

    $hGui = GUICreate("ImageList AddIcon", 400, 300)
    $listview = GUICtrlCreateListView( "", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
    _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
    GUISetState()

    ; Load images
    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146)
    _GUICtrlListView_SetImageList($listview, $hImage, 1)

    ; Add columns
    _GUICtrlListView_AddColumn($listview, "Column 1", 120)
    _GUICtrlListView_AddColumn($listview, "Column 2", 100)
    _GUICtrlListView_AddColumn($listview, "Column 3", 100)

    ; Add items
    _GUICtrlListView_AddItem($listview, "",-1)
    _GUICtrlListView_AddSubItem($listview, 0, "", 1)
    _GUICtrlListView_AddSubItem($listview, 0, "", 2, 2)
    _GUICtrlListView_AddItem($listview, "")
    _GUICtrlListView_AddSubItem($listview, 1, "", 1)
    _GUICtrlListView_AddItem($listview, "")
    _GUICtrlListView_AddItem($listview, "")
    _GUICtrlListView_AddItem($listview, "")
    _GUICtrlListView_AddSubItem($listview, 4, "", 1)
    _GUICtrlListView_AddItem($listview, "")
    _GUICtrlListView_AddSubItem($listview, 5, "", 1)
    _GUICtrlListView_AddSubItem($listview, 5, "", 2, 3)

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc

listview_icon_bug.png

First enters the index icon.
To remove this???

 

i want insert icon to sub index #2

not insert index...

help...me 

I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks.

Link to comment
Share on other sites

davidkim,

This is kind of a hoky solution but it works.  I added a white bit map image to the image table and specified that image for all _guictrllistview_additem statements.  Like so...

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

_Main()

Func _Main()
    Local $hGui, $listview, $hImage
;~  Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)
 Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_DOUBLEBUFFER)

    $hGui = GUICreate("ImageList AddIcon", 400, 300)
    $listview = GUICtrlCreateListView( "", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
    _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
    GUISetState()

    ; Load images
    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146)
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($ListView, 0xffffFF, 16, 16)) ; < ----  create blank (white image)
    _GUICtrlListView_SetImageList($listview, $hImage, 1)

    ; Add columns
    _GUICtrlListView_AddColumn($listview, "Column 1", 120)
    _GUICtrlListView_AddColumn($listview, "Column 2", 100)
    _GUICtrlListView_AddColumn($listview, "Column 3", 100)

    ; Add items
    _GUICtrlListView_AddItem($listview, "",6)
    _GUICtrlListView_AddSubItem($listview, 0, "", 1)
    _GUICtrlListView_AddSubItem($listview, 0, "", 2, 2)
    _GUICtrlListView_AddItem($listview, "",6)
    _GUICtrlListView_AddSubItem($listview, 1, "", 1,4)  ; < ----- added this to test
    _GUICtrlListView_AddItem($listview, "",6)
    _GUICtrlListView_AddItem($listview, "",6)
    _GUICtrlListView_AddItem($listview, "",6)
    _GUICtrlListView_AddSubItem($listview, 4, "", 1)
    _GUICtrlListView_AddItem($listview, "",6)
    _GUICtrlListView_AddSubItem($listview, 5, "", 1)
    _GUICtrlListView_AddSubItem($listview, 5, "", 2, 3)

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

davidkim,

This is kind of a hoky solution but it works.  I added a white bit map image to the image table and specified that image for all _guictrllistview_additem statements.  Like so...

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

_Main()

Func _Main()
    Local $hGui, $listview, $hImage
;~  Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)
 Local $exStyles = BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_DOUBLEBUFFER)

    $hGui = GUICreate("ImageList AddIcon", 400, 300)
    $listview = GUICtrlCreateListView( "", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
    _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
    GUISetState()

    ; Load images
    $hImage = _GUIImageList_Create(16, 16, 5, 3)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 168)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 137)
    _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 146)
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($ListView, 0xffffFF, 16, 16)) ; < ----  create blank (white image)
    _GUICtrlListView_SetImageList($listview, $hImage, 1)

    ; Add columns
    _GUICtrlListView_AddColumn($listview, "Column 1", 120)
    _GUICtrlListView_AddColumn($listview, "Column 2", 100)
    _GUICtrlListView_AddColumn($listview, "Column 3", 100)

    ; Add items
    _GUICtrlListView_AddItem($listview, "",6)
    _GUICtrlListView_AddSubItem($listview, 0, "", 1)
    _GUICtrlListView_AddSubItem($listview, 0, "", 2, 2)
    _GUICtrlListView_AddItem($listview, "",6)
    _GUICtrlListView_AddSubItem($listview, 1, "", 1,4)  ; < ----- added this to test
    _GUICtrlListView_AddItem($listview, "",6)
    _GUICtrlListView_AddItem($listview, "",6)
    _GUICtrlListView_AddItem($listview, "",6)
    _GUICtrlListView_AddSubItem($listview, 4, "", 1)
    _GUICtrlListView_AddItem($listview, "",6)
    _GUICtrlListView_AddSubItem($listview, 5, "", 1)
    _GUICtrlListView_AddSubItem($listview, 5, "", 2, 3)

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc

kylomas

 

wow .... not image index number set icon ???

I interest am many quite in AutoitScript.From that is [http://cafe.naver.com/autoitscript[/color]] Korea of cafe(blog) to be operating, [size="2"][color="#ff00ff"]English cannot well[/size].Many help it requests.To read, it stands it thanks.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...