First time post & very thankful for all the useful posts on this site. The following are two examples of working code that I have tweaked from this site and ahk's board. Credit goes out to ahk's "garry" for the combined boxes and to this site's "Robert Ilbrink" for the idea and functionality on the double click return current selection.
In short I have two pieces of working code that I would like to combine in the following way:
I am looking for a way to add the functionality of the double click in the second code example to the combined 'drop down + listbox' example shown below. *Note: If I could keep the same button functionality that would be great because not only can you double click, but you can also hit enter with the highlighted text and it will retrieve and send the selected text.
First Program(Drop Down + ListBox)
gosub,ddlx
ACTIONMOVIS=MISSION|007
COMEDIMOVIS=QENGUIN|BRUSALL
HORRORMOVIS=RING|13GHOST
FANTASYMOVIE=AVATA|CHOCOLAT
Gui, Add, DropDownList,gAPLY x12 y70 w100 h100 vDROPDOWN, %LST%
Gui, Add, ListBox, x132 y70 w80 h180 vLISTBOXM
gui,Show
GuiControl,1: Choose,dropdown,Comedy ;-- << preselect
gosub,aply
return
;-- this can be interessant instead using a very long line --
DDLX:
LST=
(Ltrim Join|
Action
Horror
Comedy
Fantasy
Drama
)
return
APLY:
gui,1:submit,nohide
guicontrol,1:,LISTBOXM,|
listboxm=
If DROPDOWN=Action
LISTBOXM=%ACTIONMOVIS%
If DROPDOWN=Comedy
LISTBOXM=%COMEDIMOVIS%
If DROPDOWN=Horror
LISTBOXM=%HORRORMOVIS%
If DROPDOWN=Fantasy
LISTBOXM=%FANTASYMOVIE%
guicontrol,1:,LISTBOXM,%LISTBOXM%
listboxm=
return
GuiClose:
ExitApp
second program (ListBox with Double Click & Enter Functionality)
#SingleInstance Force
Gui, Add, ListBox, h150 w140 vMyListBox gMyListBox, MISSION|007|RING|13GHOST|QENGUIN|BRUSALL| AVATA|CHOCOLAT
Gui, Add, Button, Default, Input
Gui, +AlwaysOnTop
Gui, Show
return
MyListBox:
if A_GuiControlEvent <> DoubleClick
return
GuiControlGet, MyListBox ; Retrieve the ListBox's current selection.
Send, !{Esc}
Sleep, 200
SendInput, %MyListBox% `
return
ButtonInput:
Gui, Submit, NoHide
Send, !{Esc}
Sleep, 200
SendInput, %MyListBox% `
Return
GuiClose:
GuiEscape:
Gui, Destroy
ExitApp
Thanks again in advance for your ideas and suggestions. -Alex