Page 1 of 1

Button OnEvent

Posted: 05 Jun 2021, 14:51
by Finallf
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"
}

Re: Button OnEvent  Topic is solved

Posted: 05 Jun 2021, 15:26
by swagfag
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(*) { ... }

Re: Button OnEvent

Posted: 05 Jun 2021, 15:35
by Finallf
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/