Button OnEvent Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Finallf
Posts: 18
Joined: 30 Oct 2020, 13:52

Button OnEvent

Post by Finallf » 05 Jun 2021, 14:51

by logic it should work, but it doesn't, the MoveMouse() function is not executed.
Any light?

Code: Select all

...
Global DebugGui := Gui()
DebugGui.Add("Edit", "w320 r3 ReadOnly vDebugView","")
DebugGui.Add("Button","w80 x251 y58","&Mover").OnEvent "Click", MoveMouse)
DebugGui.Show("NoActivate")

MoveMouse() {
	MouseMove 9, 940, 50, "R"
}

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Button OnEvent  Topic is solved

Post by swagfag » 05 Jun 2021, 15:26

well, uve got a space where an open-paren should have been, for one
once u fix that, realize that the click event will try to inject parameters into the associated event handler. ur function doesn't define any. either define some, or make ur function variadic, or make it variadic but discard the parameters if u dont care about processing them, ie MoveMouse(*) { ... }

Finallf
Posts: 18
Joined: 30 Oct 2020, 13:52

Re: Button OnEvent

Post by Finallf » 05 Jun 2021, 15:35

regarding the space it was just a typo here on the forum, the code is correct :D
Got it, I need to have some expected value, even if it's *.
Thanks again o/

Post Reply

Return to “Ask for Help (v2)”