包含GuiControl的功能不适用于热键 [英] function containing GuiControl doesn't work with hotkey

查看:59
本文介绍了包含GuiControl的功能不适用于热键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

test() {
    GuiControl, , abc, 123456789
}

GUI New
GUI Add, ListBox, xm y+m w100 h100 vabc
GUI Add, Button, xm y+m w60 h30 grun, Add
GUI Show, Autosize
Return

run:
    test()
    return

GuiClose:
    ExitApp

!1::
    test()
    MsgBox 1
    return

当我按下Alt + 1键时,我想调用test(),但是上面的代码不起作用.仅输出消息"1".

I wanna call test() when I press the key Alt + 1, But my code above doesn't work. Only the message '1' is output.

显然我似乎误会了一些..该如何解决这个问题?

Obviously I seem to be misunderstanding something.. How to solve this problem?

推荐答案

这将显示一个包含列表控件的GUI窗口,并在 ALT-1 时在其中添加带有"123456789"的行被按下

This displays a GUI window containing a list control and appends a row with "123456789" to it when ALT-1 is pressed

test() {
  GuiControl Alpha:, abc, 123456789
}

GUI Alpha: New
GUI Add, ListBox, xm y+m w100 h100 vabc
GUI Add, Button, xm y+m w60 h30 grun, Add
GUI Show, Autosize
Return

run:
    test()
    return

GuiClose:
    ExitApp

!1::
    test()
    return


默认情况下,热键中的

GUI命令将引用不同的gui线程.您可以使用 GUI名称( Alpha:在上面的示例中)以指定现有的GUI窗口.


GUI commands within hotkeys will refer to different gui threads by default. You can use a GUI Name (Alpha: in the above example) to specify an existing GUI window.

这篇关于包含GuiControl的功能不适用于热键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆