My gui does not recognize an event Topic is solved

Discuss the future of the AutoHotkey language
aleks3ad
Posts: 6
Joined: 15 Nov 2020, 11:28

My gui does not recognize an event

Post by aleks3ad » 04 Dec 2022, 18:16

Hi friends, i need to help me :/ ... when add event to my gui, this throws an error:

"Error: Parameter #2 of Gui.Control.Prototype.OnEvent is invalid.
Specifically: Click"

for some strange reason it doesn't recognize the string "Click", thank you

Code: Select all

objX := {a:{}, b:{}, c:{}}
objX.a := ["⁰", "¹", "²"]
objX.b := ["θ", "β", "δ"]
objX.c := ["∏", "∑", "√"]

myGui := Gui()
for k, v in objX.OwnProps() {
    for i, j in v {
		if(i = "1") {
			myGui.Add("Button", "ym w40 h40", j).OnEvent("Click", j)
		} else {
			myGui.Add("Button", "xp w40 h40", j) ;.OnEvent("Click", j)
		}
	}
}
myGui.Show()
return

⁰(*){
    A_Clipboard := "⁰"    
}
¹(*){
    A_Clipboard := "¹"
}
²(*){
    A_Clipboard := "²"
}
θ(*){
    A_Clipboard := "θ"
}
β(*){
    A_Clipboard := "β"
}
δ(*){
    A_Clipboard := "δ"
}
∏(*){
    A_Clipboard := "∏"
}
∑(*){
    A_Clipboard := "∑"
}
√(*){
    A_Clipboard := "√"
}

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]

User avatar
thqby
Posts: 396
Joined: 16 Apr 2021, 11:18
Contact:

Re: My gui does not recognize an event  Topic is solved

Post by thqby » 04 Dec 2022, 19:14

This is also a bug. @lexikos

In the current case, the type of parameter 2 is wrong. A function is required, but the additional error information given is incorrect.
.OnEvent('click',%j%)

aleks3ad
Posts: 6
Joined: 15 Nov 2020, 11:28

Re: My gui does not recognize an event

Post by aleks3ad » 04 Dec 2022, 19:56

ooohhh, thank you ^^

Post Reply

Return to “AutoHotkey Development”