Hi!
Ich hab schon die Suchfunktion benutzt, aber irgendwie ist kein ein passendes Ergebnis für mich dabei.
Also, ich habe eine Textdatei, wo mehrere Daten in Textform drin stehen. Alle Daten sind per Absatz von einander getrennt. Also
Daten in Zeile 1
Daten in Zeile 2
Daten in Zeile 3; sollen beispielsweise gleich ausgelesen werden
Daten in Zeile 4
[...]
Diese Datei heißt z.B.: Datei.txt. Hierzu dann der Code:
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#Include <File.au3>
#include <GuiListView.au3>
$Daten= ("Datei.txt")
Global $ar
If Not FileExists($Daten) Then Exit MsgBox(16,"","Datei nicht gefunden!"&@CRLF&$Daten)
_FileReadToArray($Daten, $ar)
If @error Then Exit MsgBox(16,"","Fehler beim Lesen mit FileReadToArray!")
$GUIList = GuiCreate("Liste", 750,550, -1, -1)
$Exit = GUICtrlCreateButton("Verlassen", 650, 510, 80, 25)
$list = GUICtrlCreateListView("Hier stehen die ganzen Daten aus Datei.txt drin:", 9, 140, 728, 361, $LVS_EDITLABELS)
_GUICtrlListView_SetView($list, 0)
For $i = 1 To $ar[0]
GUICtrlCreateListViewItem($ar[$i],$list)
Next
GUISetState()
[/autoit] [autoit][/autoit] [autoit]while 1
$msg = GUIGetMsg()
Select
Case $msg = $Exit
GUIDelete()
ExitLoop
Case $msg = $GUI_EVENT_CLOSE
GUIDelete()
ExitLoop
EndSelect
WEnd
Also soweit bin ich schon, dass ich die Daten richtig anzeigen lassen kann.
Nun zu den Fragen.
1)
Also es ist ja nur eine Spalte vorhanden, die Bezeichnung wird aber nach 25 Zeichen mit [...] abgekürzt. Der Inhalt wird demnach auch abgekürzt. Wie kann man die Spaltenbreite auf die Listenbreite (hier: 750) definieren, (auch wenn ich bei $list die Breite auf 140 einstelle, wird es gekürzt)
2)
$LVS_EDITLABELS habe ich integriert um die einzelnen Daten in der Liste editieren zu können. Wie kann man das machen, dass wenn ich einen Wert unbenannt hab, dass dieser dann automatisch so in die Datei.txt reingeschrieben wird? (aktuell hat das unbenennen keinen Effekt, es wird automatisch der alte Wert wieder angenommen)
3)
Wie kann ich mir mit meiner Methode einen ganz bestimmten Wert anzeigen lassen? Also wenn ich z.B. Zeile 3 anklicke und danach auf einen Button, der mir den Wert als MsgBox ausgibt sollte in der Mitteilung stehen: "Daten in Zeile 3; sollen beispielsweise gleich ausgelesen werden"
4)
Kann ich einen bestimmte Zeile aus der Tabelle per Taste Entf oder per einen Button löschen, ohne dass dort eine Text-freie Stelle bleibt?
5)
Ist es Möglich den Hintergrund dieser Liste Transparent darzustellen? Hab es mit GUICtrlSetBkColor($list, $GUI_BKCOLOR_TRANSPARENT) versucht, aber da kommt dann nur ein Schwarzer Hintergrund
Gibt es Elegantere oder Einfachere Möglichkeiten Listen darzustellen, als meine oben?
Per Suchfunktion fand ich so etwas ähnliches:
Spoiler anzeigen
#include <GuiConstantsEx.au3>
#include <GuiListBox.au3>
$GUI = GUICreate("Items einfärben",400,200)
GUISetState()
Dim $Array[3]
$Array[0] = "Test1"
$Array[1] = "Test2"
$Array[2] = "Test3"
$List = _GUICtrlListBox_Create($GUI,"",0,0,400,200)
For $i = 0 to Ubound($Array,1)-1
_GUICtrlListBox_AddString($List,$Array[$i])
Next
Do
$msg = GUIGetMsg()
Until $msg = -3
Mit Arrays (weiß noch nichtmal richtig was das ist, nur das es eine Art Tabelle ist) kenn ich mich allerdings noch so gut wie garnicht aus.
Hoffe jemand kann mir helfen
mfg Henry