Incremental search in listbox without sort

Put simple Tips and Tricks that are not entire Tutorials in this forum
jkeks
Posts: 24
Joined: 20 Oct 2019, 00:24
Contact:

Incremental search in listbox without sort

12 Apr 2020, 09:08

this hack use edit.
Edit component let you do incremental search by any char in lines, not only first char. And thats cool !
you just need this little function:

Code: Select all

Gui Add, Edit,    ge1 x1   y1  w180 h20 r1 vSearch
Gui Add, ListBox,     x1   y21 w180 h400   vSite   hwndSite, %sites%

...

; on edit change
e1:
	Gui,Submit,NoHide
	sitesArr := StrSplit(sites, "|")
	newArr   := []
	newStr   := ""
	for k,v in sitesArr
	{
		if InStr(v, Search, false)>0
		{
			newArr.push(v)
		}
	}
	for k,v in newArr
		newStr .= "|" v
	GuiControl, , Site, % newStr
	GuiControl, Choose, site, 1
Return
I like it little hack :wave:
burque505
Posts: 1375
Joined: 22 Jan 2017, 19:37

Re: Incremental search in listbox without sort

13 Apr 2020, 08:13

@jkeks, thank you. Working great here!
Regards,
burque505

Return to “Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 3 guests