Add DropDown box to this GUI

Get help with using AutoHotkey and its commands and hotkeys
fenchai
Posts: 210
Joined: 28 Mar 2016, 07:57

Add DropDown box to this GUI

15 Jan 2018, 11:56

I have a GUI that let's me do a lot of custom searches, I recommend you check it out.

https://autohotkey.com/boards/viewtopic ... 88#p194488

I am still a beginner to GUIs and need a way to make it show me a dropdown OR make a listbox appear that matches with what I am currently typing. (source from a .txt or .csv file)

Say this is the list.

- one apple
- two apple
- three apple
- three melons

If I type "thr", it should show me 2 results
If I type "apple", it should show me 3 results and so on.

This is a GUI that let's me do just that https://autohotkey.com/board/topic/5205 ... le-faster/ but my GUI has so many stuff already, I have no idea how to implement it into it.

I really hope someone can make this possible. I will be offering 30 dollars to someone able to do this as an act of gratitude. :)
BoBo
Posts: 2517
Joined: 13 May 2014, 17:15

Re: Add DropDown box to this GUI

15 Jan 2018, 12:16

Keyword: "incremental search" ... [more..]
User avatar
divanebaba
Posts: 744
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Add DropDown box to this GUI

15 Jan 2018, 12:46

I took my favourite search engine from script called "Seek by Phi".
You just have to replace ListBox with ListView and some Loop, read with Fileread and you have a super search engine with display for matches.
[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.
User avatar
noname
Posts: 508
Joined: 19 Nov 2013, 09:15

Re: Add DropDown box to this GUI

15 Jan 2018, 13:20

Image

Here is a "simplified" version of a gdip library search utility i made some time ago.The edit control can be the one you use already.
Clicking a "found string" in the list will put it on the clipboard.You can create data_list by a fileread /parse .

Code: Select all

gui,+alwaysontop
Gui, add,button, w50 y10 h50 gclear,clear
gui, add,edit,x80 y10 w370 gsearch vtosearch
gui, add,listview,w450 r5 x5 vhitlist grid gcheck,search function 
gui, show,x700 y100 autosize ,Search 


data_txt=
(
one apple
two apple
three apple
three melons
melon three
)

OnMessage(0x200,"WM_Move")  ; setfocus on edit if mouse over it
return 


WM_MOVE( wParam, lParam, Msg ) {
x:=lParam &0xFFFF, y:=lParam>>16
if (A_GuiControl="tosearch")
    {
    ControlFocus, edit1,Search
    winactivate Search
    }
}

clear:
ControlSetText,edit1,,Search
ControlFocus, edit1,Search
return


check:
LV_GetText(function_name, A_EventInfo, 1)
clipboard:=function_name
soundbeep
WinSetTitle,Search,, Copied to Clipboard
sleep 1000
WinSetTitle,Copied to Clipboard,,Search
return



search:
gui,submit,nohide
LV_Delete()

loop,parse,data_txt,`n
{
  IfInString,A_LoopField,%tosearch%
  {
      IfInString, A_LoopField,%tosearch2%
      LV_Add("", A_LoopField)
  }
}
GuiControl, +Redraw, Hitlist
return

guiclose:
ExitApp






soundcloud.com/user-32706894
fenchai
Posts: 210
Joined: 28 Mar 2016, 07:57

Re: Add DropDown box to this GUI

15 Jan 2018, 21:52

noname wrote:
Here is a "simplified" version of a gdip library search utility i made some time ago.The edit control can be the one you use already.
Clicking a "found string" in the list will put it on the clipboard.You can create data_list by a fileread /parse .
Not sure what Check Label does? Looks like it puts selected row to the clipboard?

Is Search Function just an example? because it does the same thing as double-clicking with the mouse right?

Is there a way to search like how you do on excel. similar to regex but easier. If I type "ne*ple" it shows one apple etc. or is there a way to do this? (I hate regex, pls don't let this be a way lol)
User avatar
divanebaba
Posts: 744
Joined: 20 Dec 2016, 03:53
Location: Diaspora

Re: Add DropDown box to this GUI

15 Jan 2018, 22:14

fenchai wrote:... If I type "ne*ple" it shows one apple etc. ...
Seek by Phi.
You can find this in your AHK-help-file.
"If you type "ne ple" it shows one apple etc"
[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.
fenchai
Posts: 210
Joined: 28 Mar 2016, 07:57

Re: Add DropDown box to this GUI

15 Jan 2018, 22:35

divanebaba wrote:
fenchai wrote:... If I type "ne*ple" it shows one apple etc. ...
Seek by Phi.
You can find this in your AHK-help-file.
"If you type "ne ple" it shows one apple etc"
Please treat me like someone who just joined AHK :) I have no idea how to even add a custom .txt to the script. I would know less on how to add it into my code ahhaha.
A_AhkUser
Posts: 954
Joined: 06 Mar 2017, 16:18
Location: France

Re: Add DropDown box to this GUI

15 Jan 2018, 22:54

Hi Fenchai,

I'm glad you finally shared your universal searcher :) I especially like how you made it so that the GUI color change upon a prefix match :thumbup:
If you're looking for autocompletion check out also this script by nepter - not being sure if it is deprecated or not, though (btw I'm pretty sure I saw a while ago a class made from this script but it seems I cannot find it...).

Saludos desde Francia.
fenchai
Posts: 210
Joined: 28 Mar 2016, 07:57

Re: Add DropDown box to this GUI

15 Jan 2018, 23:12

A_AhkUser wrote:Hi Fenchai,

I'm glad you finally shared your universal searcher :) I especially like how you made it so that the GUI color change upon a prefix match :thumbup:
If you're looking for autocompletion check out also this script by nepter - not being sure if it is deprecated or not, though (btw I'm pretty sure I saw a while ago a class made from this script but it seems I cannot find it...).

Saludos desde Francia.
Haha Long time no see A_AhkUser!

It was with your help that I could kinda perfect the GUI for my needs. You can see that Now I am back with fire wanting more but my lack of knowledge is limiting me quite a lot :D

The Autocompletion link you sent me is very very good. I can see it working but looks like it can only search from the start and not from the middle or by wildcards which is pretty essential in my workplace, but it is still pretty cool. I will use this as reference :D

Saludos!

Return to “Ask For Help”

Who is online

Users browsing this forum: Darkfullstar, gecko, Google [Bot], Tigerlily and 30 guests