How can I reference an array address in a GUI control?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Heezea
Posts: 59
Joined: 30 Sep 2013, 21:33

How can I reference an array address in a GUI control?

10 Oct 2013, 16:57

How can I reference an array address in a GUI control? I've tried everything I can think of and tried reading several help pages/tutorials/forum searches but I'm having no luck. Please see testing script below.

Code: Select all

#SingleInstance force

i := 4 ;for testing in GUI
j := 1 ;for testing in GUI

LocA := {header:[	"Index", 	"Option"]
		,1:[		"100",  	"400"]	
		,2:[		"200",  	"300"]	
		,3:[		"300",  	"200"]	
		,4:[		"400",  	"100"]}	

;START HOTKEYS++++++++++++++++++++++++++++++++++
Numpad5::
	goto GuiFirst
return
;END HOTKEYS------------------------------------

;START GUI++++++++++++++++++++++++++++++++++
GuiFirst:
	;test to see where I'd expect it to end up
	Gui, Add, Edit, x120 y220 w420 h20 vBox1, 1
	
	;test to use % and xLoc...
	Gui, Add, Edit, x10 y10 w20 h20 vBox3, 2
	Gui, Add, Edit, % xLocA[1,1] yLocA[2,1] wLocA[i,j] h20 vBox2, % LocA[2,2]
	
	;test to use % x.Loc...
	Gui, Add, Edit, x20 y60 w20 h20 vBox4, 4
	Gui, Add, Edit, % x.LocA[1,1] y.LocA[2,1] w.LocA[%i%,%j%] h20 vBox5, 5
	
	;test to use % Loc (no x)
	Gui, Add, Edit, x40 y100 w20 h20 vBox6, 6
	Gui, Add, Edit, % LocA[1,1] LocA[2,1] LocA[i,j] h20 vBox7, 7
	
	
	Gui, Add, Button, x850 y650 w50 h30 , Cancel
	Gui, Add, Button, x910 y650 w50 h30 , OK
	; Generated using SmartGUI Creator 4.0
	Gui, Show, x100 y100 h700 w1000, New GUI Window
return

ButtonCancel:
GuiClose:
Gui, destroy
ExitApp
return

ButtonOk:
GUI, Submit
Goto GuiClose
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: How can I reference an array address in a GUI control?

10 Oct 2013, 17:09

Give this a try:

Code: Select all

Gui, Add, Edit, % "x" . LocA[1,1] " y" . LocA[2,1] " w" . LocA[i,j] " h20 vBox2", % LocA[2,2]
Heezea
Posts: 59
Joined: 30 Sep 2013, 21:33

Re: How can I reference an array address in a GUI control?

10 Oct 2013, 20:45

Ha! That worked really well. Thanks. Why didn't I think of this? Btw, one more space in front of the x in the "x" and then it's perfection.

Thank you for your help good sir.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], bobstoner289, peter_ahk, Spawnova and 350 guests