1

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

survargs
  • 11
  • 1
  • The problem is that I'd like to have this functionality because I actually have a good amount of sports teams that I use when filling out these form fields for work, and instead of having one listbox(program 2) for each of the professional and college teams and their state/country/ mascot and or sport the team/college is known for (i.e. NFL, NHL, MLB, NCAA, International Soccer Teams, etc..) I do actually have many of these memorized but would like to incorporate the functionality of the double click selection to program 1. – survargs Aug 03 '15 at 14:18
  • The problem eligible for a Stackoverflow question should be with the actual code you've tried to make and somehow didn't succeed. In which case you post your code, the error message or other description of how your code isn't doing what you expect. – wOxxOm Aug 03 '15 at 14:22
  • Appreciate the response, I did dabble on it for a few hours but was unable to get any headway because I wasn't sure where I could put the functionality of the <> doubleclick within the first program to achieve the right results. here is what I came up with: – survargs Aug 03 '15 at 20:20
  • The code before this in example 1 is the same: `code` guicontrol,1:,LISTBOXM,%LISTBOXM% listboxm= returnif A_GuiControlEvent <> DoubleClick GuiControlGet, APLY ; Retrieve the ListBox's current selection. Send, !{Esc} Sleep, 200 SendInput, %APLY% ` return GuiClose: ExitApp `code` @ wOxxOm – survargs Aug 03 '15 at 20:28
  • This is where I got stuck yesterday. I would get the following error: Error at line 42. Line Text: returnif "A_GuiControlEvent <> DoubleClick Error: This line does not contain a recognized action @wOxxOm – survargs Aug 03 '15 at 20:29

0 Answers0