I am new to GDScript and a bit newbie type in programming.....I am Trying to implement button connect signal action inside user-defined class....but its not working.....is there any other way to implement the button pressed action or any other way out
Here is simplified version of the code I am using
extends Node
class example :
var a=2
var b=6
var c
var button
func add_button(handle,text:String) :
Button_click() # working
button=Button.new()
button.text=text
button.connect("pressed",self,"Button_click") # Not working
handle.add_child(button)
func Button_click():
c=a+b
print("C="+str(c))
func _ready():
var My_Class=example.new()
My_Class.add_button(self,"Click to see C")