xcal Posted February 4, 2007 Share Posted February 4, 2007 (edited) expandcollapse popup#Include <GuiListView.au3> GUICreate('') $list = GUICtrlCreateListView('1|2', 10, 10) Dim $array[2][6], $result $array[0][1] = 2 $array[0][2] = 5 $array[0][3] = 1 $array[0][4] = 4 $array[0][5] = 3 $array[1][1] = 'is' $array[1][2] = 'example' $array[1][3] = 'this' $array[1][4] = 'sort' $array[1][5] = 'a' For $i = 1 To 5 $result &= $array[0][$i] & ' - ' $result &= $array[1][$i] & @CRLF Next MsgBox(0, 'Before', $result) For $i = 1 To 5 GUICtrlCreateListViewItem($array[0][$i] & '|' & $array[1][$i], $list) Next Dim $B_DESCENDING[_GUICtrlListViewGetSubItemsCount($list) ] _GUICtrlListViewSort($list, $B_DESCENDING, 0) For $i = 1 To _GUICtrlListViewGetItemCount($list) $array[0][$i] = _GUICtrlListViewGetItemText($list, $i - 1, 0) $array[1][$i] = _GUICtrlListViewGetItemText($list, $i - 1, 1) Next $result = '' For $i = 1 To 5 $result &= $array[0][$i] & ' - ' $result &= $array[1][$i] & @CRLF Next MsgBox(0, 'After', $result) Edited February 4, 2007 by xcal How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
Der_Andi Posted February 5, 2007 Author Share Posted February 5, 2007 @SmOke_N and all other users: IT WORKS!!! I found the right parameters with trial and error. But i don't understand, why the 5th param must be 2. I don't even understand the explanation for that parameter. _ArraySort($s, 0, 1, 0, 2, 0) Link to comment Share on other sites More sharing options...
Developers Jos Posted February 5, 2007 Developers Share Posted February 5, 2007 @SmOke_N and all other users: IT WORKS!!! I found the right parameters with trial and error. But i don't understand, why the 5th param must be 2. I don't even understand the explanation for that parameter. _ArraySort($s, 0, 1, 0, 2, 0)If you think of a 2 dimention Array as spreadsheet with rows and columns then the 5th param tells the sort routine which Array "column" to use to sort the row on. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Der_Andi Posted February 5, 2007 Author Share Posted February 5, 2007 Sure?According to help file:_ArraySort ( ByRef $a_Array [, $i_Descending [, $i_Base=0 [, $i_Ubound=0 [, $i_Dim=1 [, $i_SortIndex=0 ]]]]] )The 6th param (= $i_SortIndex) "tells the sort routine which Array 'column' to use to sort the row on."From help file: $i_SortIndex | Optional: The index to Sort on. Today i played a lot with array's and _ArraySort() and i think, i'm getting it. Slowly :-) Link to comment Share on other sites More sharing options...
Developers Jos Posted February 5, 2007 Developers Share Posted February 5, 2007 (edited) Sure? According to help file: _ArraySort ( ByRef $a_Array [, $i_Descending [, $i_Base=0 [, $i_Ubound=0 [, $i_Dim=1 [, $i_SortIndex=0 ]]]]] ) The 6th param (= $i_SortIndex) "tells the sort routine which Array 'column' to use to sort the row on." From help file: $i_SortIndex | Optional: The index to Sort on. Today i played a lot with array's and _ArraySort() and i think, i'm getting it. Slowly :-) You are right ... the 5th param is the number of dimensions like Ubound($array,2) would return these days. so really the number of rows... The UDF was written before this was available ... Edited February 5, 2007 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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