Mikeman27294 Posted September 1, 2011 Share Posted September 1, 2011 (edited) Hello everyone. I am making a small project for one of my classes at school, where the user inputs numbers, and the are sorted numerically (I didnt use array sort as this would defeat the whole purpose of the program). This works perfectly, however, I am also trying to list them as a desk check. Basically, this shows how the variables and outputs change throughout the program. I have created a GUI for this with a List View, and I am adding my items like this: GUICtrlCreateListViewItem('"'&$Array[$InnerCount]&'|'&$Array[$InnerCount+1]&'|'&$Temp&'"',$ListView) I have also have tried GUICtrlCreateListViewItem($Array[$InnerCount]&"|"&$Array[$InnerCount+1]&"|"&$Temp,$ListView) and GUICtrlCreateListViewItem('$Array[$InnerCount]&|&$Array[$InnerCount+1]&|&$Temp&,$ListView) To make this easy to unserstand for those of you who dont understand me, let's assume that $array has 3 elements - 1, 2 and 3. The problem is that the script will always take the literal value of the | instead of using it as a seperator, and so in the first cell, I have the values with the | inbetween them, not seperating them. So basically, the first column in the list view shows like this - "1|2|3", and the other columns are empty. Is there something that I am not doing correctly? Thanks. Edited September 8, 2011 by Mikeman27294 Link to comment Share on other sites More sharing options...
MvGulik Posted September 1, 2011 Share Posted September 1, 2011 (edited) GUICtrlCreateListViewItem('"'&$Array[$InnerCount]&'|'&$Array[$InnerCount+1]&'|'&$Temp&'"',$ListView)Hue. Why are you adding a leading and trailing quote(") mark to your data here. That's only needed for when there is some possible ambiguitie on what is and is not a delimiter/separator in a full string data set/line. Like with file(cmd) related commands that need to know when a space is a delimiter or part of the filespec. GUICtrlCreateListViewItem($Array[$InnerCount]&"|"&$Array[$InnerCount+1]&"|"&$Temp,$ListView)This one should work. ... Check if your still have (|) set as active delimiter. (Its a Global setting, and you probably changed is somewhere earlier in your code.) Use the AutoItSetOption() OR(short named version) Opt('GUIDataSeparatorChar', [new character, optional]) command for that. $cCurrent = Opt('GUIDataSeparatorChar') ;; check current used one. $cOld = Opt('GUIDataSeparatorChar', $cNew) ;; change, and backup old one. Opt('GUIDataSeparatorChar', $cOld) ;; restore old one. GUICtrlCreateListViewItem('$Array[$InnerCount]&|&$Array[$InnerCount+1]&|&$Temp&,$ListView)Last, but not least. Keep track of your quote counts. As this code is missing one. Invalidating the command completely. -> should have triggered a syntax error. (for starters, as I spotted a second (typo) error in it to.) Edited September 1, 2011 by iEvKI3gv9Wrkd41u "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Mikeman27294 Posted September 1, 2011 Author Share Posted September 1, 2011 Thanks. I have set that to the seperator character, but now nothing is coming up in my list view. Link to comment Share on other sites More sharing options...
MvGulik Posted September 1, 2011 Share Posted September 1, 2011 Hum. ... Only reason I can think of for there not being any data displayed is that your not feeding it any data. Your sure your array cells contain any data to be displayed. ;; optional commands to help with checking your code for syntax errors. (assuming your using Scite4AutoIt3) #AutoIt3Wrapper_Run_Au3Check=y #AutoIt3Wrapper_Au3Check_Stop_OnWarning=y #AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> _Example() ;; see GUICtrlCreateListViewItem code example in manual for more ... _MsgWait() Exit ;; === functions === ;; Func _Example() Local $listview GUICreate("listview items", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES) $listview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150) $item1 = GUICtrlCreateListViewItem("item-11|item-12|col-13", $listview) ;~ $item2 = GUICtrlCreateListViewItem("item-21|item-22|col-23", $listview) $item2 = GUICtrlCreateListViewItem("||", $listview) ;; no data in ... no data displayed. $item3 = GUICtrlCreateListViewItem("item-33|item-33|col-33", $listview) GUISetState() EndFunc Func _MsgWait() Local $iMsg Do $iMsg = GUIGetMsg() Until $iMsg = $GUI_EVENT_CLOSE EndFunc "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Malkey Posted September 2, 2011 Share Posted September 2, 2011 ... I have also have tried GUICtrlCreateListViewItem($Array[$InnerCount]&"|"&$Array[$InnerCount+1]&"|"&$Temp,$ListView) ... This line does work when proper values are in the variables $Array, $InnerCount, $Temp, and $ListView. My slant on "Listing multiple arrays into multiple columns" is :- #include <Array.au3> Local $Array1[5] = [1, 2, 3, 4, 5] Local $Array2[6] = [11, 12, 13, 14, 15, 16] Local $Array3[4] = [21, 22, 23, 24] Local $Array[3] = [$Array1, $Array2, $Array3] _ArraysDisplay($Array) ; Description - Displays any number of one dimensional arrays - one array per column. ; See _ArrayDisplay() for parameters Func _ArraysDisplay(Const ByRef $Arr, $sTitle = "Array: ListView Display", $iItemLimit = -1, $iTranspose = 1, _ $sSeparator = "", $sReplace = "|", $sHeader = "") Local $temp, $num = UBound($Arr), $max = UBound($Arr[0]) For $i = 0 To $num - 1 If $max < UBound($Arr[$i]) Then $max = UBound($Arr[$i]) Next Dim $Array2D[$num][$max] For $i = 0 To $num - 1 $temp = $Arr[$i] For $j = 0 To UBound($temp) - 1 $Array2D[$i][$j] = $temp[$j] Next Next _ArrayDisplay($Array2D, $sTitle, $iItemLimit, $iTranspose, $sSeparator, $sReplace, $sHeader) Return EndFunc ;==>_ArraysDisplay Link to comment Share on other sites More sharing options...
Mikeman27294 Posted September 2, 2011 Author Share Posted September 2, 2011 Well I am feeding data into it, and since I added the part to my script where it states the seperator to be | it hasnt displayed anything. Link to comment Share on other sites More sharing options...
Zedna Posted September 2, 2011 Share Posted September 2, 2011 Post small reproducing script then we can fix it for you ... MvGulik 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Mikeman27294 Posted September 3, 2011 Author Share Posted September 3, 2011 Ok thanks. Opt("GUIDataSeparatorChar", "|") Local $ListView = _GUICtrlListView_Create($DeskCheckGUI, "", 0, 0, 500, 500) _GUICtrlListView_SetColumnWidth($ListView, 0, 100) _GUICtrlListView_SetExtendedListViewStyle($ListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) _GUICtrlListView_InsertColumn($ListView, 0, "Apples[Current]", 100) _GUICtrlListView_InsertColumn($ListView, 0, "Apples[Current+1]", 100) _GUICtrlListView_InsertColumn($ListView, 0, "Temporary", 100) _GUICtrlListView_AddItem($ListView,$Array[$InnerCount]&"|"&$Array[$InnerCount+1]&"|"&$Temp) It is showing the values again, but the problem is that it is inserting the | character again, instead of using it as a seperator. Link to comment Share on other sites More sharing options...
MvGulik Posted September 3, 2011 Share Posted September 3, 2011 (edited) _GUICtrlListView_AddItem() only intended to add single items. so its not using the 'GUIDataSeparatorChar' option to split up your input into seperate parts. See _GUICtrlListView_AddItem() help example-code for more info. Edited September 3, 2011 by iEvKI3gv9Wrkd41u "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Zedna Posted September 3, 2011 Share Posted September 3, 2011 (edited) Local $ListView = _GUICtrlListView_Create($DeskCheckGUI, "", 0, 0, 500, 500) _GUICtrlListView_SetColumnWidth($ListView, 0, 100) _GUICtrlListView_SetExtendedListViewStyle($ListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) _GUICtrlListView_InsertColumn($ListView, 0, "Apples[Current]", 100) _GUICtrlListView_InsertColumn($ListView, 0, "Apples[Current+1]", 100) _GUICtrlListView_InsertColumn($ListView, 0, "Temporary", 100) _GUICtrlListView_AddItem($ListView, $Array[$InnerCount], 0) _GUICtrlListView_AddItem($ListView, $Array[$InnerCount+1], 1) _GUICtrlListView_AddItem($ListView, $Temp, 2) Edited September 3, 2011 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Mikeman27294 Posted September 4, 2011 Author Share Posted September 4, 2011 Oh that makes sense. I dont remember seeing mention of that in the hel file but I will look again. I will also try that other one later and let you all know how it goes for me. Thanks Link to comment Share on other sites More sharing options...
Mikeman27294 Posted September 6, 2011 Author Share Posted September 6, 2011 It worked perfectly thanks. I would have said so earlier but I have been busy with school alot recently But I have tried it with the _GUICtrlListView_AddSubitem function and it is working a charm. Again, thanks. 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