How to change GUI button text (v2) without destroying/recreating new GUI?
Posted: 23 Apr 2024, 04:35
When I click the button called "OLD", it changes to "NEW", but to achieve that, it first need to destroy the GUI, then create it agan. just an ugly behavior.
Code: Select all
#Requires AutoHotkey v2.0
global btn_name := "OLD"
x::
{
MyGui := Gui(, "Mouse")
MyGui.SetFont("s10")
MyGui.Add("Button", "w220 h30", btn_name).OnEvent("Click", ButtonClick)
MyGui.Show("w250 h100")
ButtonClick(*) {
global btn_name := "NEW"
MyGui.Destroy()
send "{x}"
}
}