A variable DDL

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
chefgamer85
Posts: 4
Joined: 18 May 2018, 21:01

A variable DDL

18 May 2018, 21:10

Hello,

I am still new at coding with this. I am trying to make a dropdown list that will have different options depending on the dropdown above it. I tried an IF ELSE but it would always just show the last in the IF statements. I thought of having the list tied to a Excel sheet but it does not display the options. Any help would be great. Thanks
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: A variable DDL

18 May 2018, 21:28

Like this?

Code: Select all

#SingleInstance,Force

oList:="list 1||list 2|list 3|"
List_1:="a||b|c|d|e|"
List_2:="f||g|h|i|j|"
List_3:="k||l|m|n|o|"

Gui,1:+AlwaysOnTop
Gui,1:Color,Black

Gui,1:Add,DDL,x10 y10 w200 r3 AltSubmit vList_Selector gChange_List,% oList
Gui,1:Add,DDL,x10 y100 w200 r5 vSelected_List gShow_It,% List_1

Gui,1:Show,w220 h200,Is This It?
Gui,1:Submit,NoHide
return

GuiClose:
GuiEscape:
*^ESC::
	ExitApp
	
Change_List:
	Gui,1:Submit,NoHide
	GuiControl,1:,Selected_List,% List_%List_Selector%
	return
	
Show_It:
	Gui,1:+OwnDialogs
	Gui,1:Submit,NoHide
	msgbox, you selected %Selected_List% in List %List_Selector%
	return
chefgamer85
Posts: 4
Joined: 18 May 2018, 21:01

Re: A variable DDL

22 May 2018, 20:22

Somewhat what I was looking for. But I want the options in the variable list to show only options based upon what is selected in the 1st list
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: A variable DDL

22 May 2018, 23:33

chefgamer85 wrote:Somewhat what I was looking for. But I want the options in the variable list to show only options based upon what is selected in the 1st list

That is what it is doing.

if you select list 1 it shows options a,b,c,d,and e
if you select list 2 it shows options f,g,h,i,and j
etc.
chefgamer85
Posts: 4
Joined: 18 May 2018, 21:01

Re: A variable DDL

23 May 2018, 19:39

I might be missing something then. When I used the code you showed, If list 2 is selected, it shows a,b,c,d,e,f,g,h,i and j. And if list 3 is selected it shows a, b, c, d, e, f, g, h, i, j, k, l, m, n and o
imustbeamoron
Posts: 44
Joined: 18 Aug 2016, 22:56

Re: A variable DDL

23 May 2018, 20:19

change this line

Code: Select all

GuiControl,1:,Selected_List,% List_%List_Selector%
to this.

Code: Select all

GuiControl,1:,Selected_List,% "|" List_%List_Selector%
the bar "|" at the beginning will 'clear the ddl and then add the items, as it is, it is just appending items to the ddl.
chefgamer85
Posts: 4
Joined: 18 May 2018, 21:01

Re: A variable DDL

29 May 2018, 19:23

Thanks! That is what I was looking for it to do

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], inseption86, jaka1, mebelantikjaya and 310 guests