Autohotkey 如何动态更新自动热键GUI元素

Autohotkey 如何动态更新自动热键GUI元素,autohotkey,Autohotkey,我已经用AHK创建了一个GUI。我将Id和描述存储为键值对。当用户输入ID时,我想用存储在关联数组中的相应Desc更新Desc。如何动态更新GUI ^h:: oKeys := [] oValues := [] oArray := {} if (WinExist("ahk_id " hwndgui)) { Gui, Destroy return } gui, add, text,, Type: Gui, Add, DropDownList,vType,

我已经用AHK创建了一个GUI。我将Id和描述存储为键值对。当用户输入ID时,我想用存储在关联数组中的相应Desc更新Desc。如何动态更新GUI

^h::

oKeys := []
oValues := []
oArray := {}


if (WinExist("ahk_id " hwndgui)) {
    Gui, Destroy
    return
}

gui, add, text,, Type:
Gui, Add, DropDownList,vType, TSO|PAX|DVI 
gui, add, text,, ID:
Gui, Add, Edit, vId
gui, add, text,, Partial|Complete:
Gui, Add, DropDownList,vPartial, Partial||Complete
gui, add, text,, Left-Behind:
Gui, Add, DropDownList,vLeft, False||True
gui, add, text,, XFR-Type:
Gui, Add, DropDownList,vXFR, Standard||Contact|Theft
gui, add, text,, DESC:
Gui, Add, Edit, vDesc , oArray[(TypeId)]
Gui, Add, Button, Default gOK, OK

Gui, Show, Hide

Gui, +LastFound
hwndgui:=WinExist()
OK:
Gui, Submit

oKeys.Push((TypeId))
oValues.Push((Desc))
Loop, % oKeys.Length()
oArray[oKeys[A_Index]] := oValues[A_Index]
    

if WinExist("labelImg")
    WinActivate  ; Uses the last found window.
    Send, ^a
    Send, %Type%_%Id%_%Partial%_%Desc%
    for vKey, vValue in oArray
    vOutput .= vKey " " vValue "`r`n"
    MsgBox, % vOutput
    
Gui, Show
return

你能给出一个更简单的例子或者更详细的解释,说明这段代码应该发生什么吗?我真的搞不懂你想做什么,但问题本身听起来似乎有一个非常简单的解决方案,我肯定会知道的。很抱歉给你带来困惑。我基本上希望根据用户在特定EditBox中输入的值更新EditBox的值。例如,如果用户在Type和ID中输入详细信息,则应检查关联数组中是否存在格式为TypeID=Desc的现有键值对。如果存在,则需要使用该值更新Desc的默认值,这仍然很难理解。至少,如果底部的WinExist,我肯定说不出
下面的东西是什么。但您至少需要使用来编辑控件(例如,
GuiControl,Desc,hello
),我只需要一个示例,说明如何检测编辑文本框上的焦点丢失,并用它更新另一个编辑框值。我尝试过使用GuiControl,但它似乎没有按需要工作。