Hey ich habe folgenden Code:
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GUILISTVIEW.au3>
#Region ### START Koda GUI section ### Form=
$iExListViewStyle = BitOR($LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES,$LVS_EX_FULLROWSELECT)
Dim $variable
$Form1 = GUICreate("Test GUI", 397, 284, 192, 114)
$hListView = GUICtrlCreateListView("Column 0|Column 1|Column 3", 56, 16, 266, 150)
_GUICtrlListView_SetExtendedListViewStyle($hListview, $iExListViewStyle)
_GUICtrlListView_RegisterSortCallBack($hListview)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 70)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 70)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 70)
$Button1 = GUICtrlCreateButton("Add sample 1", 24, 192, 155, 73, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Add sample 2", 200, 192, 155, 73, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $hListview ; Sortieren
_GUICtrlListView_SimpleSort ($hListView, $variable, GUICtrlGetState($hListView))
_GUICtrlListView_SortItems ($hListview, GUICtrlGetState($hListView))
Case $Button1
$indexhandle = GUICtrlCreateListViewItem ("Sample1", $hListView)
GUICtrlSetImage ($indexhandle, "sample1.ico")
$tmpindex = _GUICtrlListView_GetItemCount($hListview) - 1
_GUICtrlListView_SetItem ($hListView, "sample1", $tmpindex, 1)
_GUICtrlListView_SetItem ($hListView, "sample1", $tmpindex, 2)
Case $Button2
$indexhandle = GUICtrlCreateListViewItem ("Sample2", $hListView)
GUICtrlSetImage ($indexhandle, "sample2.ico")
$tmpindex = _GUICtrlListView_GetItemCount($hListview) - 1
_GUICtrlListView_SetItem ($hListView, "sample2", $tmpindex, 1)
_GUICtrlListView_SetItem ($hListView, "sample2", $tmpindex, 2)
EndSwitch
WEnd
Die Icons könnt ihr beliebig auswählen.
Nehmt doch bitte einfach mal 2 x beliebige Icons und nennt sie in sample1.ico und ein anderes in sample2.ico um und startet das Script. Sobald ich jetzt die Listview sortieren möchte, bleiben die Icons stehen und bleiben nicht an dem richtigen hängen. Gibt es eine Lösung dafür?
Danke im Voraus
Gruß Snify