Take a look at
Objects and
Arrays. On the "Objects" page, at first you will mostly just need to know the info in the first couple sections. This is very important:
Objects wrote:An object
reference is a pointer or "handle" to a particular object. Like strings and numbers, object references can be stored in variables, passed to or returned from functions and stored in objects. After copying a reference from one variable to another as in
x := y, both variables refer to the same object.
Object shows the built in methods a standard AHK object has. Methods are like functions, except they belong to an object and they do something to their object when called.
In AHK, "Arrays" are the same thing as objects. We commonly refer to simple objects as arrays, but all arrays are objects.
To add all the keys from an array into a DDL, you will need to enumerate the object and collect each key:
Code: Select all
CityArray := {Phoenix: 1, Portland: 1, "Inland Empire": 1, Sacramento: 1}
MyDDL := ""
for key, val in CityArray ; Note, this will enumerate keys in alphabetical order
MyDDL .= key "|" (A_Index = 1 ? "|" : "")
Gui, Add, DropDownList,, %MyDDL%
Gui, Show
return
GuiClose:
ExitApp