Smart Comboboxes

Post your working scripts, libraries and tools for AHK v1.1 and older
danielo515
Posts: 58
Joined: 18 Feb 2015, 15:06

Smart Comboboxes

29 Apr 2015, 04:17

Hello everyone.

I just found this piece of code:

http://www.autohotkey.com/board/topic/1 ... omboboxes/

It adds atocomplete to comboboxes while you type.
The posted date is quite old, so I would like to know if a better solution has appeared since then.

Regards
User avatar
joedf
Posts: 8951
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Smart Comboboxes

30 Apr 2015, 03:46

Thanks for sharing :)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Smart Comboboxes

30 Apr 2015, 18:26

Here is an example I have used in the past:

Code: Select all

; http://www.autohotkey.com/board/topic/42127-combobox-help/

clients:="|Alex|Bob|Cathy|Fred|Jim|John|"
Sort,clients,D|
Gui, Add, ComboBox, gcclient vcclient w200, % clients ;Alex|Bob|Cathy|Fred|Jim|John
gui, add, text, w200 vclientname, This box Auto Fills.
Gui, Add, Button, Default x-40 y-40 gEntered,Enter
gui, show,, Client Auto Complete
return

cclient:

gui, submit, nohide

If (!GetKeyState("BackSpace","P") and cclient and pos:=InStr(clients,"|" . cclient)){
	GuiControl,,clientname, % (found:=SubStr(clients,pos+1,InStr(clients,"|",1,pos+1)-pos-1))
	GuiControl,Text,cclient, %found%
	SendInput % "{End}" . "+{Left " . StrLen(found)-StrLen(cclient) . "}"
} else GuiControl,,clientname
return

Entered:
	gui, submit
	MsgBox % "You picked:`n" cclient
return

GuiClose:

GuiEscape:

exitapp
I slightly modified it from the example at the link to show how to make "Enter" work.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
just me
Posts: 9450
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Smart Comboboxes

01 May 2015, 04:21

danielo515
Posts: 58
Joined: 18 Feb 2015, 15:06

Re: Smart Comboboxes

01 May 2015, 05:13

Hello Just me,

Thank you for sharing your library. The problem with your autocomplete approach is that seems to require the identification of the control. I mean, it is not generic for any control in the gui but a specific one.
just me
Posts: 9450
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Smart Comboboxes

01 May 2015, 10:45

It's only a sample how to use the CB functions for auto-completion.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: JoeWinograd and 120 guests