GUICtrlCreateListViewItem newest item on top. how to?
3 posts in this topic
Hello guys, I would have the need to import into the GUICtrlCreateListView all * .txt files in a folder. The * .txt files contain all of the same formatting separated by "|", the script should go on every single file and bring me back the result in the GUICtrlCreateListView. For now I only managed to upload a single file * .txt into the GUICtrlCreateListView with this code:
Case $Button_Find $File_txt = "\\cond\UPDATE\test.txt" Dim $Array_List _FileReadToArray($File_txt, $Array_List) $Limit_Array = UBound($Array_List) - 1 For $i = 1 To $Limit_Array $All_Box = String($Array_List[$i]) GUICtrlCreateListViewItem($All_Box, $List) Next For $i2 = 0 To _GUICtrlListView_GetColumnCount($List) _GUICtrlListView_SetColumnWidth($List, $i2, $LVSCW_AUTOSIZE_USEHEADER) Next
I'm working on this project:
$Import = GUICtrlCreateButton("Import", 15, 175, 90, 40, $WS_GROUP) $List = GUICtrlCreateListView("Name|Address|E-mail", 15, 220, 400, 363, $LVS_SORTDESCENDING) $Item1 = GUICtrlCreateListViewItem("test|test|test", $List) GUISetState(@SW_SHOW, $GUI) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $Exit Exit Case $Import $Table_Import = FileOpenDialog("Import list '*.txt'", @DesktopDir & "\", "Text (*.txt)") If @error Then ContinueLoop GUICtrlSetData($Item1, $Table_Import) In the text file the fields are delimited with "|" and the values are not in the same row but one below the other.
However in the txt file the sum of the values may change.
Can you help me?
$item = GUICtrlCreateListViewItem("", $ListVw) ; create ListViewItems empty cells GUICtrlSetBkColor($item, $Clr) ; Set the background color for the listview item ; loop the result array $hist = $r0 & "|" & $r1 & "|" & $r2 & "|" & $r3 & "|" & $r4 GUICtrlSetData($item, $hist) ; set the ListView values I can color rows. What I want to achieve is to consistently color column 3, creating a column with the same colour.
I am looking for an EASY way to do this. I have seen examples that can color each individual cell, but it requires 1000's of lines of code.
The ideal solution would be something like GuiCtrlSetListViewItemBkColor()
Any ideas please?