DropDownList Change Selection

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ktbjx
Posts: 71
Joined: 11 Jul 2015, 23:53

DropDownList Change Selection

22 Aug 2017, 20:28

ok so i have 4 datas on my dropDownList, and a button named "Switch!"
is it possible to change the selected list if click SWITCH?
my datas are: North, South, West, East
my scenario is like this:
i will choose any from those 4 lists Ex: North
then when i click the button, my selection will change to South..

if i choose South and click the button, my selection will change to North
if i choose West and click the button, my selection will change to East
if i choose East and click the button, my selection will change to West
Basically if i choose any, i wanted the selection no change to their opposite side.
is that possible??

Code: Select all

Gui, +Delimiter`n
Gui, +LastFound +OwnDialogs +AlwaysOnTop +Caption -ToolWindow -Resize
gui, font, s14 Tahoma

gui, font, s12 Verdana

Gui, Add, Text, gMyOthers,OTHERS

gui, font, s14 Arial Rounded MT Bold

gui, font, s11  CDefault, Verdana
gui, add, DDL, w275 vddlC gFilterC,
Gui, Add, Button,gok7 vok7, Switch!
Gui, show, autosize,%noext% - %shtName%


IfWinExist SampleDescription
	WinGetTitle, ScoRm

filterC:
gui, submit, nohide

box3 := SubStr(A_GuiControl,4)
colC := ""
loop, parse, data3, `r,`n
	{
	Arr := StrSplit(a_loopfield, a_tab)
		colC .= Arr[1] "`n"
}
guicontrol,,ddlC,`n%colC%
guicontrol, chooseString, ddlC, % (C <= box3) ? ddlC : ""
if box3 = C
Return

ok7:
Gui, Submit, NoHide
msgbox % ddlC
msgbox % Arr
msgbox % arr[1]
if(ddlC = "North_Wall")
{
	msgbox % colC
msgbox % data3
	
		guicontrol, chooseString, ddlC, 1
				msgbox % ddlC
	;colC := "South_Wall"
	GoTo, FilterC
}
else if (ddlC = "South_Wall")
{
	GuiControl,,ddlC,North_Wall
}
else if(ddlC = "West_Wall")
{
	GuiControl,,ddlC,East_Wall
}
else if (ddlC = "East_Wall")
{
	GuiControl,,ddlC,West_Wall
}
else if (ddlC = "")
{
	
}

Return
PS: my Code is connected to an Excel File, that's where i put the lists
Rindis
Posts: 213
Joined: 23 Dec 2013, 13:58
Location: Norway
Contact:

Re: DropDownList Change Selection

22 Aug 2017, 23:49

Something like this?

Code: Select all

SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetBatchLines, -1

#SingleInstance, Force

Gui, Add, DropDownList, vDirections x30 y70 w290 h200 , North||South|East|West
Gui, Add, Button, gSwitch x200 y270 w190 h60 , Switch!
Gui, Add, Button, gSwitch2 x200 y370 w190 h60 , Switch2
Gui, Show, w500 h600, Untitled GUI
return



Switch:
gui, submit, nohide

If Directions = South
	GuiControl,choose ,Directions, 1
If Directions = North
	GuiControl,choose ,Directions, 2
If Directions = West
	GuiControl,choose ,Directions, 3
If Directions = East
	GuiControl,choose ,Directions, 4

return

Switch2:

GuiControl,  +AltSubmit , Directions
gui, submit, nohide

If Directions = 2
	GuiControl,choose ,Directions, 1
If Directions = 1
	GuiControl,choose ,Directions, 2
If Directions = 4
	GuiControl,choose ,Directions, 3
If Directions = 3
	GuiControl,choose ,Directions, 4
GuiControl,  -AltSubmit , Directions

return





esc::
GuiClose:
ExitApp


Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: hiahkforum, NullRefEx and 124 guests