PerryRaptor Posted February 14, 2006 Share Posted February 14, 2006 Cannot figure out how to read an entire array into GuiCtrlCreateListView(). So far, all I can do is get one line in at a time. ;this isn't working $items = GuiCtrlCreateListViewItem($array[$i][0] & "|" & $array[$i][1] & "|" & $array[$i][2],$listview) Link to comment Share on other sites More sharing options...
GaryFrost Posted February 14, 2006 Share Posted February 14, 2006 Cannot figure out how to read an entire array into GuiCtrlCreateListView(). So far, all I can do is get one line in at a time. ;this isn't working $items = GuiCtrlCreateListViewItem($array[$i][0] & "|" & $array[$i][1] & "|" & $array[$i][2],$listview) Far as I know you would have to create a udf to do what you want. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
PerryRaptor Posted February 14, 2006 Author Share Posted February 14, 2006 how about a text file with lines in it like this line1|1data1|1data2 Line2|2data1|2data2 GuiCtrlCreateListViewItem($text_file,$listview) Link to comment Share on other sites More sharing options...
GaryFrost Posted February 14, 2006 Share Posted February 14, 2006 how about a text file with lines in it like thisline1|1data1|1data2Line2|2data1|2data2GuiCtrlCreateListViewItem($text_file,$listview) ListView doesn't have that capability SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
GaryFrost Posted February 14, 2006 Share Posted February 14, 2006 (edited) how about a text file with lines in it like this line1|1data1|1data2 Line2|2data1|2data2 GuiCtrlCreateListViewItem($text_file,$listview) You could do something like: #include <File.au3> Func _ReadFileIntoListView($s_file, $h_listview) Local $aRecords, $x _FileReadToArray($s_file, $aRecords) If Not _FileReadToArray($s_file,$aRecords) Then SetError(1) Return 0 EndIf For $x = 1 to $aRecords[0] GuiCtrlCreateListViewItem($aRecords[$x],$h_listview) Next EndFunc Edited February 14, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 15, 2006 Share Posted February 15, 2006 Cannot figure out how to read an entire array into GuiCtrlCreateListView(). So far, all I can do is get one line in at a time. ;this isn't working $items = GuiCtrlCreateListViewItem($array[$i][0] & "|" & $array[$i][1] & "|" & $array[$i][2],$listview) You understand the items you list are going to be for different COLUMNS, not ROWS. See my example: #include <GuiConstants.au3> ; 2D array of data DIM $avData[4][2] For $r = 0 to 3 $avData[$r][0] = "Item-" & $r & "-0" $avData[$r][1] = "Item-" & $r & "-1" Next $Gui_1 = GUICreate("List View Test", 300, 110) $List_1 = GUICtrlCreateListView(" Column One | Column Two ", 10, 10, 280, 90) For $r = 0 to 3 GUICtrlCreateListViewItem($avData[$r][0] & "|" & $avData[$r][1], $List_1) Next GUISetState(@SW_SHOW, $Gui_1) While (1) If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit WEnd Each item in the GuiCtrlCreateListView() seperated by "|" is a COLUMN header. Each instance of GuiCtrlCreateListViewItem() creates one ROW, with multiple items split to the different COLUMNS. Cheers! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PerryRaptor Posted February 15, 2006 Author Share Posted February 15, 2006 (edited) I solved it!!! I can now read in a multi-dimensional array populating all of the GuiCtrlCreateListViewItems. Thanks for the idea Gary to use a For...Next loop to create all of the GuiCtrlCreateListViewItems. Edited February 15, 2006 by PerryRaptor Link to comment Share on other sites More sharing options...
randallc Posted February 15, 2006 Share Posted February 15, 2006 Hi,And if your array has more than 4000 rows or too many columns......Try SQL_Array2D.au3inSQL UDF for AutoITBest, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
surfer Posted February 15, 2006 Share Posted February 15, 2006 Try that: #include <file.au3> #include <GuiConstants.au3> #include <Array.au3> $file = "server.txt" Dim $aRecords If Not _FileReadToArray($file ,$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:") Exit EndIf GuiCreate("XXXXXX", 200, 430) $counterOne = 0 $counterOne = $aRecords[0]-1 $listTest = "" $ListServer = GUICtrlCreateList("", 10, 40, 180, 97, -1) For $x = 1 to $counterOne $listTest = $listTest&"|"& StringStripCR($aRecords[$x]) GUICtrlSetData(-1, $listTest) Next GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Greetings surfer Link to comment Share on other sites More sharing options...
PerryRaptor Posted February 18, 2006 Author Share Posted February 18, 2006 @RandallC...nice UDF. Hopefully the arrary dimensions for my needs will not grow to more than [100][5]. @Sufer...I took your idea of StringStripCR($aRecords[$x]) shortening my code. Thanks to everyone for the ideas and the help...I'm not too bright when it comes to GUI... coding. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now