创建一个带有可点击按钮的图形用户界面(GUI)。

huangapple go评论40阅读模式
英文:

Create a GUI with clickable buttons

问题

#m::
Gui, Show, w200 h200, 弹出窗口标题
Gui, Add, Button, default, 1
Gui, Add, Button, default, 2
Gui, Add, Button, default, 2
Return

但我现在想知道,如何为这些按钮添加功能。如果我按下数字,我想前往特定的网站,例如按下1时前往http://www.nu.nl。

您有关于如何让这个代码工作的建议吗?

英文:

I have created the following code that triggers a pop screen with some buttons

#m::
 Gui, Show, w200 h200, Window title
 Gui, Add, Button, default, 1
 Gui, Add, Button, default, 2
 Gui, Add, Button, default, 2
Return

I would like to add now however what I should do to add a function for these buttons. I would like to go to particular websites if I enter then number. So for example to http>//www,nu.nl if I press 1.

Any advice on how I get this working?

答案1

得分: 1

尝试类似以下的代码:

#SingleInstance Force
#UseHook

Gui, +AlwaysOnTop +Resize
Gui, add, Button, x5 y10 w250 h20 g1, 1 --> autohotkey questions - Stack Overflow 
Gui, add, Button, x5 y30 w250 h20 g2, 2 --> windows-10 questions - Stack Overflow
Gui, add, Button, x5 y50 w250 h20 g3, 3 --> command-line questions - Stack Overflow
return

#m:: Gui, show, x0 y0 w280 h200 NoActivate, Websites

1:: Run https://stackoverflow.com/questions/tagged/autohotkey
2:: Run https://stackoverflow.com/questions/tagged/windows-10
3:: Run https://stackoverflow.com/questions/tagged/command-line

GuiClose:
ExitApp

请注意,我只翻译了代码部分,没有翻译其他内容。

英文:

Try something like this:

#SingleInstance Force
#UseHook

Gui, +AlwaysOnTop +Resize
Gui, add, Button, x5 y10 w250 h20 g1, 1 --> autohotkey questions - Stack Overflow 
Gui, add, Button, x5 y30 w250 h20 g2, 2 --> windows-10 questions - Stack Overflow
Gui, add, Button, x5 y50 w250 h20 g3, 3 --> command-line questions - Stack Overflow
return
 
#m:: Gui, show, x0 y0 w280 h200 NoActivate, Websites


1:: Run https://stackoverflow.com/questions/tagged/autohotkey
2:: Run https://stackoverflow.com/questions/tagged/windows-10
3:: Run https://stackoverflow.com/questions/tagged/command-line

GuiClose:
ExitApp

huangapple
  • 本文由 发表于 2023年7月6日 18:21:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76627819.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定