Nabend
Hab da en Problem.
Ich habe ein ListView, mit 4 Spalten.
Nun will ich, dass sich der Inhalt des ListViews entsprechend der 3ten Spalte sortiert.
Ich habs mit _GUICtrlListView_SimpleSort versucht, aber ich kapiers i.wie net so ganz.
Die Hilfe mach das ganze leider nur noch kompliezierter.
Könnt mir da einer bei helfen?
Hier mal das Script:
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#Include <GuiListView.au3>
Global $SelDia
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Löschomat", 777, 447, 195, 126)
GUISetFont(8, 800, 0, "MS Sans Serif")
GUISetBkColor(0x878787)
$ListView1 = GUICtrlCreateListView("Dateiname|Größ (KB)|Endung|Pfad", 0, 0, 605, 445)
GUICtrlSendMsg(-1, 0x101E, 0, 200)
GUICtrlSendMsg(-1, 0x101E, 1, 80)
GUICtrlSendMsg(-1, 0x101E, 2, 70)
GUICtrlSendMsg(-1, 0x101E, 3, 250)
GUICtrlCreateGroup("Handlungen", 612, 4, 157, 189)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Auswahl löschen", 620, 32, 143, 33)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Checkbox1 = GUICtrlCreateCheckbox("Löschanfrage ein/aus", 620, 168, 145, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("Aktuallisieren", 620, 112, 143, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("Ordner aufrufen", 620, 140, 143, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button3
_DirSelect ($ListView1, 0)
Case $Button1
$Read1 = GUICtrlRead ($Checkbox1)
If $Read1 = $GUI_CHECKED Then
$Ch = 1
Else
$Ch = 0
EndIf
_Delete ($ListView1, $Ch)
Case $Button2
_DirSelect ($ListView1, 1)
EndSwitch
WEnd
Func _DirSelect ($Handle, $Update)
If $Update = 0 Then
$SelDia = FileSelectFolder ("Bitte wählen Sie einen Ordner aus.", "", 4)
EndIf
If Not @Error Then
_GUICtrlListView_DeleteAllItems($Handle)
$Search = FileFindFirstFile ($SelDia & "\*.*")
$FileCount = DirGetSize ($SelDia, 1)
For $i = 1 To $FileCount[1] Step 1
$NextFile = FileFindNextFile ($Search)
$Split = StringRight ($NextFile, 3)
GUICtrlCreateListViewItem ($NextFile & "|" & Round (FileGetSize ($SelDia & "\" & $NextFile) /1024, 4) & "|" & $Split & "|" & $SelDia, $Handle)
Next
_GUICtrlListView_SimpleSort ($Handle, True, 3)
EndIf
EndFunc ;==> _DirSelect
Func _Delete ($Handle, $Checked)
$i1 = _GUICtrlListView_GetSelectedIndices ($Handle, True)
$i2 = _GUICtrlListView_GetItem ($Handle, $i1[1], 0)
$i3 = _GUICtrlListView_GetItem ($Handle, $i1[1], 2)
If $Checked = 1 Then
If MsgBox (4, "Wirklich löschen?", "Soll die folgende Datei wirklich gelöscht werden:" & @CRLF & $i3[3] & "\" & $i2[3]) = 6 Then
FileDelete ($i3[3] & "\" & $i2[3])
_GUICtrlListView_DeleteItemsSelected ($Handle)
EndIf
Else
FileDelete ($i3[3] & "\" & $i2[3])
_GUICtrlListView_DeleteItemsSelected ($Handle)
EndIf
EndFunc ;==> _Delete
MfG