orbs Posted October 20, 2010 Share Posted October 20, 2010 hello everyone, i know that $LBS_SORT is a style that forces a list to be sorted alphabetically, and if i remove this style, the list is sorted by the order in which items are added. but i don't see any options of controlling the sorting. for example, to my current needs, what is the best way to sort a list in reverse alphabetical order? thanks in advance, Or Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
GEOSoft Posted October 20, 2010 Share Posted October 20, 2010 (edited) It then becomes time to get an array involved. If you are already creating the list from an array you are half there, otherwise you have 2 choices. Create an array with your items in it or use StringSplit() to create an array from the list then _ArraySort(), then convert it back to a string. Of course you don't want to use the $LBS_SORT or it won't work. Example: #Include<Array.au3> Global $sData, $aData $sData = "Apples|Oranges|Pears" $aData = StringSplit($sData, "|", 2) _ArraySort($aData, 1) $sData = _ArrayToString($aData) Global $hMyList = GUICtrlCreateList("", 10, 10 , 100, 100) GUICtrlSetData($hMyList, $sData) EDIT: If you made the mistake of using a 1 based array to create the list originally then you have to change $sData = _ArrayToString($aData)to$sData = _ArrayToString($aData, "|", 1)and don't forget if you didn't use "|" for the delimiter you also have to change the second parameter to use whatever your delimiter was. Edited October 20, 2010 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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