ComboBox: +Sort Visually / but most recent choice on AutoComplete Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
DRocks
Posts: 565
Joined: 08 May 2018, 10:20

ComboBox: +Sort Visually / but most recent choice on AutoComplete

26 Sep 2018, 07:56

Good morning guys,

As title says briefly, I'm trying to use the default option +Sort alphabetic order in ComboBox to have a nice visual layout of a list of names.
This is great everything is simple for this part.

Now what I'm doing is that everytime a user completes the action in GUI, my .ini data file with name's list will be reordered in terms of the most recent used.
For example, if you just used "Walmart" as your last choice, when you complete the action, this name will be removed from where it was in the .ini file then repositionned in first place.

Code: Select all

 		New_Fournisseurs_IniListe:= 	"|" LastActiveClientFournisseur RegExReplace(Fournisseurs_IniListe,"\|" LastActiveClientFournisseur "\|","|")
	;--------------------------------------------------------------------------------
	IniDelete, Data.ini, Fournisseurs, Fournisseurs_IniListe
	IniWrite, %New_Fournisseurs_IniListe%, Data.ini, Fournisseurs, Fournisseurs_IniListe ; nouvelle liste créer ici 
	IniRead, Fournisseurs_IniListe, Data.ini, Fournisseurs, Fournisseurs_IniListe ; refresh variable containing names
	GuiControl,,ComboBox1, % "|" Fournisseurs_IniListe ; refresh ComboBox names from new list's var
But my problem is that if you use +Sort in the ComboBox, it doesn't matter if the .ini Data is sorted out in terms of most recent names used.
The AutoComplete choice will always be dependant on the ComboBox sort mode which is alphabetic.

How can you still keep visual layout of alphabetic order with the ComboBox names,
but also let the AutoComplete be the first match according to the .ini data's "recently used names" order.

As a last example, if you have ten names starting with "The ...something" - how can you AutoComplete with the "Most recently" used name starting with "The...."?

What I have tried is:
1: Removing +Sort from comboBox to see if it works and it does. But this is not what I want.
2: Temporarily change to -Sort in the ComboBox just before GuiControl, ChooseString happens. But it doesnt work


Do you have an idea how to do this please?
DRocks
Posts: 565
Joined: 08 May 2018, 10:20

Re: ComboBox: +Sort Visually / but most recent choice on AutoComplete  Topic is solved

27 Sep 2018, 06:31

I am sorry for any inconvenience

After hard work I found it was best to use a listbox underneat the combobox.

The LBX holds only relevent data when user types and is the source for autocompletion. But the combobox is intact with A to Z order.

Thanks anyways. Silence made me work harder and find myself.. sometimes we ask to quick for help. Sorry
User avatar
emmanuel d
Posts: 90
Joined: 17 Nov 2013, 04:45

Re: ComboBox: +Sort Visually / but most recent choice on AutoComplete

27 Sep 2018, 10:47

It would be nice if you would post the code for the solution, so others could benefit from your hard work ;)
DRocks
Posts: 565
Joined: 08 May 2018, 10:20

Re: ComboBox: +Sort Visually / but most recent choice on AutoComplete

27 Sep 2018, 16:15

its a bit problematic because its shared all over the code.
But I could try to isolate the most relevant feature later :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, kingina, mcd and 186 guests