Arik Posted July 29, 2014 Share Posted July 29, 2014 (edited) Hello to all the great autoit experts. I use a long script that amongst other actions it creates a gui with a combo box. I use an ini file for its entries with dozens of sections and stumbled upon a problem with the $CBS_SORT style. I wrote a small example to show the problem and hope you have an answer for me: #include <GUIConstants.au3> GUICreate("My GUI combo") GUICtrlCreateCombo("", 10, 10, 100, 20, $CBS_DROPDOWNLIST + $CBS_AUTOHSCROLL + $CBS_SORT) GUICtrlSetData(-1, "1 Option|2 Option|3 Option|4 Option|5 Option|6 Option|7 Option|8 Option|9 Option|10 Option|11 Option|12 Option") GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd When opening the drop box menu, the options are displayed "1 Option10 Option11 Option12 Option2 Option3 Option4 Option5 Option6 Option7 Option8 Option9 Option". Is there any way to sort the entries as "1 Option2 Option3 Option4 Option5 Option6 Option7 Option8 Option9 Option10 Option11 Option12 Option", but still keep the $CBS_SORT style? Thanks for any help. Edited July 29, 2014 by Arik Link to comment Share on other sites More sharing options...
Zedna Posted July 29, 2014 Share Posted July 29, 2014 (edited) Yes. You can do it but not as easily as you probably think. You can store your values into 2D array - each value split by space and put to first and second array dimension. Then sort array by first dimension with numeric type of comparision Finally fill ComboBox from sorted array a put result string for each item as concatenate of first and second array dimension item. Edited July 29, 2014 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Arik Posted July 30, 2014 Author Share Posted July 30, 2014 Zedna, thanks for your answer, but your solution sounds too complicated for me. I initially use the $CBS_SORT style because of another problem i encountered. I wanted that when the user types the starting characters of the entry, the dropbox will change according to what he types. In the upper example if the user types "12", the dropbox will select "12 Option". If you remove the $CBS_SORT style from the GUICtrlCreateCombo command, the entries are displayed in the exact order of the data given, but when the user types "12", the "2 Option" is selected. This applies also when the entries are letters, for example, "Adobe|Dropbox". Is there a solution, a simple one i hope, for this problem? Link to comment Share on other sites More sharing options...
Zedna Posted July 30, 2014 Share Posted July 30, 2014 (edited) You can create your own "autosearch" functionality. Try to search this forum I'm sure I have seen such scripts here, just use some apropriate keyword for searching, maybe: +combo +auto +search +combo +autocomplete +combobox +autocomplete ... Don't forget to search "in titles only". Edited July 30, 2014 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
JScript Posted July 30, 2014 Share Posted July 30, 2014 @ArikSee: '?do=embed' frameborder='0' data-embedContent>>JS http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Arik Posted July 30, 2014 Author Share Posted July 30, 2014 @Arik See: '?do=embed' frameborder='0' data-embedContent>> JS Thanks JS. I tested your great UDF, but it's not suited to my situation. I use $CBS_DROPDOWNLIST instead of $CBS_DROPDOWN intentionally. When I test your example, but replace $CBS_DROPDOWN with $CBS_DROPDOWNLIST, I get the same result as without the autofill. Link to comment Share on other sites More sharing options...
Arik Posted July 30, 2014 Author Share Posted July 30, 2014 You can create your own "autosearch" functionality. Try to search this forum I'm sure I have seen such scripts here, just use some apropriate keyword for searching, maybe: +combo +auto +search +combo +autocomplete +combobox +autocomplete ... Don't forget to search "in titles only". Zedna, I searched according to your suggestions and all the results I've got were relevant to JScript's solution: they don't use $CBS_DROPDOWNLIST at all. 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