Is it possible to send the input from the edit control to the value of the corresponding key in the map as shown below?
The problem here is that the "MyVar" requires to be set before even the GUI is created which is useless in this case as the user must input that value first.
If I remove line 6 then the script doesn't work.
Or am I again trying something which is not designed to work as desired here?
Code: Select all
F12::MyGUIFunc()
MyGUIFunc()
{
global MyVar := ''
MyMap := MyMap_Func()
keyarr := []
For key In MyMap
keyarr.Push(key)
MyGui := Gui()
MyGui.Add("DropDownList", "vMyDDL sort", keyarr)
MyGui.Add("Edit", "vMyEdit")
MyGui.Add("Button", , "Submit").OnEvent("Click", OK)
MyGui.Show()
OK(*)
{
Saved := MyGui.Submit(true)
global MyVar := Saved.MyEdit
MsgBox MyMap[Saved.MyDDL]
}
}
MyMap_Func()
{
global MyVar
Return Map(
'Key1', 'This is MyEdit value: ' MyVar ', in value one',
'Key2', 'This is MyEdit value: ' MyVar ', in value two'
)
}