Find in Combobox get or select item

Get help with using AutoHotkey and its commands and hotkeys
chngrcn
Posts: 129
Joined: 29 Feb 2016, 08:55

Find in Combobox get or select item

16 Aug 2018, 08:39

When I enter a letter from the keyboard while in the ComboBox,
for example,

When I write the word "CAR" in the ComboBox, it will find the word "CAR".
When I write the word "CAR 90" in the ComboBox, it will find the word "CAR 90".

that is, the keyboard entries made in the ComboBox, from within the ComboBox.

Code: Select all

#NoTrayIcon
brafs:="APLLE|BANANA|CRANBERRIES|WATERMELOON|PEACE|CHERY|CAR|CAR 1|CAR 2|CAR 20|CAR 31|CAR 90|CAR 97|ELEPHANT|DUNKEY|MONKEY"
Gui, Add, ComboBox, x32 y30 w140 h90 vCOMBO1 , % brafs
Gui, Add, DropDownList, x192 y30 w130 h90 vDROP1 , % brafs

Gui, Show, w392 h161, Untitled GUI
return

GuiClose:
ExitApp
chngrcn
Posts: 129
Joined: 29 Feb 2016, 08:55

Re: Find in Combobox get or select item

17 Aug 2018, 03:13

I would like to ask specialist friends who can help. It's a bit urgent because ...
User avatar
divanebaba
Posts: 744
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Find in Combobox get or select item

17 Aug 2018, 19:44

Hi.
How about this solution?

Code: Select all

#NoTrayIcon
brafs:="APLLE|BANANA|CRANBERRIES|WATERMELOON|PEACE|CHERY|CAR|CAR 1|CAR 2|CAR 20|CAR 31|CAR 90|CAR 97|ELEPHANT|DUNKEY|MONKEY"
Gui, Add, ComboBox, hwndCOMBO1ID x32 y30 w140 h90 vCOMBO1 gCombo1, % brafs
Gui, Add, DropDownList, x192 y30 w130 h90 vDROP1 , % brafs

Gui, Show, w392 h161, Untitled GUI
return

GuiClose:
ExitApp


COMBO1: 
{
	ControlGetText, Eingabe,, ahk_id %Combo1ID%
	ControlGet, Liste, List, , , ahk_id %Combo1ID%
	If ( !CheckDelKey && !CheckBackspaceKey && RegExMatch(Liste, "`nmi)^(\Q" . Eingabe . "\E.*)$", Match) ){
	ControlSetText, , %Match%, ahk_id %Combo1ID%
	Selection := StrLen(Eingabe) | 0xFFFF0000
	SendMessage, CB_SETEDITSEL := 0x142, , Selection, , ahk_id %Combo1ID%
	} Else {
	CheckDelKey = 0
	CheckBackspaceKey = 0
	}
return
}
[Starklichtbirne IQ >> 250!!] Dank deutscher Lehrerempfehlung, nur Süperdepp und Hartz4-Bezieher, statt Abitürient und Einkommensbezieher.
[Strong light bulb IQ >> 250!!] Thanks to german teacher's recommendation, willful and welfare recipient, instead of high school graduate and moneymaker.

Entering high school for foreign children is not prohibited in GERMANY, it's only made nearly impossible by government.
Virtually the only way - visiting high school abroad.

ADVERTISING: Patent pending strip accumulator - süper advanced technology - priceless inexpensive, space-saving, energy efficient - Patent priority for sale.
chngrcn
Posts: 129
Joined: 29 Feb 2016, 08:55

Re: Find in Combobox get or select item

20 Aug 2018, 12:35

Hi.
How about this solution?

Code: Select all

#NoTrayIcon
[/quote]

The solution is pretty good. it does not allow backward deletion with backspace key alone. I can write and delete the data in the combo. I can intervene in the combo. While in the combo, filter out the data in the ComboBox if you press any key on the keyboard. I can do it in the delete process with the backspace key.

thanks in advance for your help ..
Divanebaba Kurban bayramın mübarek olsun abi.. Saygılar :)
User avatar
divanebaba
Posts: 744
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Find in Combobox get or select item

20 Aug 2018, 20:16

Thanks, chngrcn.
I'm sorry not responding to your PM last time.

I've created a new method for storing huge amounts of metal and plastic strips and have learned how to create patent papers.
Now my method is patent pending.
It will replace most of common strip accumulators for rollforming pipes and profiles, made from steel.
If I find a financial strong buyer, I will buy this forum and its members too. :HeHe: :HeHe:
DRAWING_011_klein.jpg
(98.68 KiB) Downloaded 111 times
Not to bad - newest technology. Patent priority for sale. Contact as fast as you can worlds most intelligent fool.
[Starklichtbirne IQ >> 250!!] Dank deutscher Lehrerempfehlung, nur Süperdepp und Hartz4-Bezieher, statt Abitürient und Einkommensbezieher.
[Strong light bulb IQ >> 250!!] Thanks to german teacher's recommendation, willful and welfare recipient, instead of high school graduate and moneymaker.

Entering high school for foreign children is not prohibited in GERMANY, it's only made nearly impossible by government.
Virtually the only way - visiting high school abroad.

ADVERTISING: Patent pending strip accumulator - süper advanced technology - priceless inexpensive, space-saving, energy efficient - Patent priority for sale.
A_AhkUser
Posts: 879
Joined: 06 Mar 2017, 16:18
Location: France

Re: Find in Combobox get or select item

21 Aug 2018, 14:46

it does not allow backward deletion with backspace key alone.
Just for reference:

Code: Select all

If ( !CheckDelKey && !CheckBackspaceKey && RegExMatch(Liste, "`nmi)^(\Q" . Eingabe . "\E.*)$", Match) ){
should be:

Code: Select all

If ( !GetKeyState("Delete") && !GetKeyState("BackSpace") && RegExMatch(Liste, "`nmi)^(\Q" . Eingabe . "\E.*)$", Match)) {
The solution is pretty good
User avatar
divanebaba
Posts: 744
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Find in Combobox get or select item

21 Aug 2018, 16:43

Hello A_AhkUser.

The sample was a code, I found years ago in this forum.
I've tested your optimization and now it works much better, maybe perfect.
It is so convincing, that I immediately have replaced this part of code in my used scripts. :mrgreen: :mrgreen:

:salute: Respect and thanks for sharing your excellent knowledge.
[Starklichtbirne IQ >> 250!!] Dank deutscher Lehrerempfehlung, nur Süperdepp und Hartz4-Bezieher, statt Abitürient und Einkommensbezieher.
[Strong light bulb IQ >> 250!!] Thanks to german teacher's recommendation, willful and welfare recipient, instead of high school graduate and moneymaker.

Entering high school for foreign children is not prohibited in GERMANY, it's only made nearly impossible by government.
Virtually the only way - visiting high school abroad.

ADVERTISING: Patent pending strip accumulator - süper advanced technology - priceless inexpensive, space-saving, energy efficient - Patent priority for sale.
A_AhkUser
Posts: 879
Joined: 06 Mar 2017, 16:18
Location: France

Re: Find in Combobox get or select item

21 Aug 2018, 20:33

I've tested your optimization and now it works much better, maybe perfect.
It is so convincing, that I immediately have replaced this part of code in my used scripts. :mrgreen: :mrgreen:
Really?! I thought it was simply a typo from your part. I can only guess that years ago you simply copy-pasted it without trying to decrypt it. But you have no excuses: the one who wrote it even made an effort to give an explicit name to its variables: CheckDelKey, CheckBackspaceKey... :terms: :mrgreen: Well, I'm glad I could help :D

Thanks again for sharing this code ;)

Cheers

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot] and 45 guests