Code: Select all
mainGui := Gui(,"HELP")
mainGui.Add("Button", "x550 y300", "test").Onevent("click", test)
mainGui.Add("Button", "x550 y330", "test2").Onevent("click", test2)
num := mainGui.Add("Text", "x550 y280 w30", "1")
mainGui.Opt("+AlwaysOnTop +ToolWindow")
mainGui.Show("x0 y510 w640 h350")
Stop := true
test(_obj, * )
{
while(Stop)
{
num.value++
Sleep(100)
}
}
test2(_obj, * )
{
global Stop := !Stop
}
What I want is to use the Test1 button as a toggle.
I want to write a code where when I press the Test1 button, its name changes to "Stop" and the program runs, and when I press the renamed "Stop" button again, its name changes back to "Test1" and the program stops.
Can you help me with how to write the code?