der titel beschreibt mein ziel, das problem ist, dass die funktion getList() nicht funktioniert
Spoiler anzeigen
#include <GUIConstants.au3>
#include <GUIListBox.au3>
#include <ListBoxConstants.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <File.au3>
#Include <GuiListView.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Fishlist", 224, 254, 332, 154)
$List1 = GUICtrlCreateList("", 0, 0, 129, 253,$LBS_SORT)
$Button1 = GUICtrlCreateButton("Add Player", 136, 8, 81, 25, 0)
$Button2 = GUICtrlCreateButton("Delete", 136, 40, 81, 25, 0)
$Button3 = GUICtrlCreateButton("Search", 136, 200, 81, 41, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
_getList() ;füllt $list1 mit informationen aus list.log
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_Exit()
case $Button1
_add ()
case $Button2
_delete()
EndSwitch
WEnd
func _add () ;fügt der liste ein item hinzu (getestet & läuft)
$temp = InputBox("Add Player","Gib den Spielernamen an","","",100,40)
if @error = 0 Then
_GUICtrlListBox_AddString($List1,$temp)
EndIf
EndFunc
func _delete () ;löscht das markierte item (getestet & läuft)
$name = GUICtrlRead($list1)
$temp = _GUICtrlListBox_FindString($List1, $name)
if MsgBox(4,"Delete",$name & " löschen?") = 6 Then
_GUICtrlListBox_DeleteString($List1,$temp)
EndIf
EndFunc
func _getList () ;hier liegt das problem
$file = FileOpen("list.log",0)
for $i = 1 to _FileCountLines($file) ;für jede zeile im logfile-
$text = FileReadLine("list.log",$i) ;wird die zeile ausgelesen -
_GUICtrlListView_AddString($list1,$text) ;und der liste hinzugefügt (hier liegt das problem glaub ich
Next
FileClose($file)
EndFunc ;oder auch nicht
func _saveList () ;speichert den content der liste in list.log, 1 item / zeile (getestet & läuft)
$log = FileOpen("list.log",2)
For $i = 0 To _GUICtrlListBox_GetCount($List1) - 1
FileWriteLine($log, _GUICtrlListBox_GetText($List1, $i))
Next
FileClose($log)
EndFunc
func _exit ()
_saveList ()
exit
endfunc
anstelle von GUICtrlListBox_AddString hab ich schon _GUICtrlListBox_AddItem versucht,
außerdem GUICtrlSetData(string), ohne erfolg