Jump to content

problem with _GUIImageList_Create .... [ icons problem ]


matte
 Share

Go to solution Solved by Yashied,

Recommended Posts

hey ...

i learned  everything i know about autoit from this perfect forum .. at the begining i want to say Thanks for all of you in general

background :

i created an dll which have all of my icons , and  add them to the image list and everything worked prefectly ... tell i needed that some of the icons have to be in
size of 16 x 16 and others must be 32 x 32

The Problem :

so i tried to devided them into two different image lists and attatched them to list view
the problem is that just the second image list icons is showing

Asking for :

i need the two image lists beacuse of the size of the icons that i am showing ...
So how could i add tow different image lists without effecting each other ?
or any other idea that can solve my problem ?

Ps : i tried to divided the icons into 2 dlls to try my luck and that did  Not helped  .... stupid move i know o:)


Ps : i searched throw google and the forum and did not have any luck
 

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
$IS_GUI = GUICreate("Problem example", 412, 366, 192, 124)
Global $LISTVIEW = GUICtrlCreateListView("", 8, 8, 394, 350)

Global $EX_STYLES = BitOR($LVS_EX_DOUBLEBUFFER,$WS_EX_CLIENTEDGE,$LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)
_GUICtrlListView_SetExtendedListViewStyle($LISTVIEW,$EX_STYLES)
GUISetState(@SW_SHOW)
Global $CION_SIZE_1 = 16    , $CION_SIZE_2 = 32
Global $BIG_ICONS_1 = False , $BIG_ICONS_2 = True
Global $DLL_1 = "example_1.dll" , $DLL_2 = "example_2.dll"
;~  First image list 
$ICON_LV_HEADER = _GUIImageList_Create( $CION_SIZE_1 , $CION_SIZE_1 , 5 , 3 , 3)
_GUIImageList_AddIcon($ICON_LV_HEADER  ,$DLL_1 , 0 , $CION_SIZE_1)          ; 0
_GUIImageList_AddIcon($ICON_LV_HEADER  ,$DLL_1 , 1 , $CION_SIZE_1)          ; 1
_GUIImageList_AddIcon($ICON_LV_HEADER  ,$DLL_1 , 2, $CION_SIZE_1)          ; 2
_GUICtrlListView_SetImageList($LISTVIEW, $ICON_LV_HEADER,  1)
;~  Seocnd image list 
$ICON_LV_ITEMS = _GUIImageList_Create( $CION_SIZE_2 , $CION_SIZE_2 , 5 , 3 , 2)
_GUIImageList_AddIcon($ICON_LV_ITEMS  ,$DLL_2 , 0 , $CION_SIZE_2)          ; 0 , Tried 3 with no change and no icon
_GUIImageList_AddIcon($ICON_LV_ITEMS  ,$DLL_2 , 1 , $CION_SIZE_2)          ; 1 , Tried 4 with no change and no icon
_GUICtrlListView_SetImageList($LISTVIEW, $ICON_LV_ITEMS,  1)

; Add Colums
$NC_0  = _GUICtrlListView_InsertColumn($LISTVIEW, 0,  "1", 100,2,0) 
$NC_1  = _GUICtrlListView_InsertColumn($LISTVIEW, 1,  "2", 100,2,1)
$NC_2  = _GUICtrlListView_InsertColumn($LISTVIEW, 2,  "3", 100,2,2)

; Add Itmes 
$First = "ITEM"
$2nd = "subitem 1 "
$3rd = "subitem 2 "
GUICtrlCreateListViewItem($First,$LISTVIEW)
_GUICtrlListView_SetItem($LISTVIEW,$2nd ,0, 1,0)
_GUICtrlListView_SetItem($LISTVIEW,$3rd ,0, 2,1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Am so sorry for being so late .... i just came from work

here is an example for what i am asking for

the dlls is in the attachment i add them to rar cuz i can't upload the dll's directly

Dlls.rar

Edited by matte
Link to comment
Share on other sites

  • Solution

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

$IS_GUI = GUICreate("Problem example", 412, 366, 192, 124)
Global $LISTVIEW = GUICtrlCreateListView("", 8, 8, 394, 350)

Global $EX_STYLES = BitOR($LVS_EX_DOUBLEBUFFER, $WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)
_GUICtrlListView_SetExtendedListViewStyle($LISTVIEW, $EX_STYLES)
GUISetState(@SW_SHOW)
Global $CION_SIZE_1 = 16, $CION_SIZE_2 = 32
Global $BIG_ICONS_1 = False, $BIG_ICONS_2 = True
Global $DLL_1 = "example_1.dll", $DLL_2 = "example_2.dll"

;~  Seocnd image list
$ICON_LV_ITEMS = _GUIImageList_Create($CION_SIZE_2, $CION_SIZE_2, 5, 3, 2)
_GUIImageList_AddIcon($ICON_LV_ITEMS, $DLL_2, 0, $CION_SIZE_2) ; 0 , Tried 3 with no change and no icon
_GUIImageList_AddIcon($ICON_LV_ITEMS, $DLL_2, 1, $CION_SIZE_2) ; 1 , Tried 4 with no change and no icon
_GUICtrlListView_SetImageList($LISTVIEW, $ICON_LV_ITEMS, 1)

;~  First image list
$ICON_LV_HEADER = _GUIImageList_Create($CION_SIZE_1, $CION_SIZE_1, 5, 3, 3)
_GUIImageList_AddIcon($ICON_LV_HEADER, $DLL_1, 0, $CION_SIZE_1) ; 0
_GUIImageList_AddIcon($ICON_LV_HEADER, $DLL_1, 1, $CION_SIZE_1) ; 1
_GUIImageList_AddIcon($ICON_LV_HEADER, $DLL_1, 2, $CION_SIZE_1) ; 2
$HEADER = _GUICtrlListView_GetHeader($LISTVIEW)
_GUICtrlHeader_SetImageList($HEADER, $ICON_LV_HEADER)

; Add Colums
$NC_0 = _GUICtrlListView_InsertColumn($LISTVIEW, 0, "1", 100, 2, 0)
$NC_1 = _GUICtrlListView_InsertColumn($LISTVIEW, 1, "2", 100, 2, 1)
$NC_2 = _GUICtrlListView_InsertColumn($LISTVIEW, 2, "3", 100, 2, 2)

; Add Itmes
$First = "ITEM"
$2nd = "subitem 1 "
$3rd = "subitem 2 "
GUICtrlCreateListViewItem($First, $LISTVIEW)
_GUICtrlListView_SetItem($LISTVIEW, $2nd, 0, 1, 0)
_GUICtrlListView_SetItem($LISTVIEW, $3rd, 0, 2, 1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

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...