I save a list of all buttons in my widgets in a parent class so I can dynamically assign numbered keyboard shortcuts to them depending on how many there are. But I hope I’m missing something simple that prevents me to call their onclick events?
Hello. This is the way i implemented mine. Hope this helps.
299435-
][1]
But I have a parent class that handles all common UI events, and individual child classes with lots of different button widgets with their own onclicks in them. It’s not really feasible to go into each button in each child class and add a custom event on top of the existing onclick and even if I do, I’m not sure how to trigger those from the parent class, especially since there then needs to be a unique event per button, while onclick is the same event regardless of child class or button…
But I have a parent class that handles all common UI events, and individual child classes with lots of different button widgets with their own onclicks in them. It’s not really feasible to go into each button in each child class and add a custom event on top of the existing onclick and even if I do, I’m not sure how to trigger those from the parent class, especially since there then needs to be a unique event per button, while onclick is the same event regardless of child class or button…
The easiest way to do this is just make a custom event, plug it into the same pin the oncluck event is going into and then manually call the custom event
i mean you would trigger them by just calling them like a function but even if you did bind events to it, youd have to do this in every child class. you cant call onclick events like that. If they are all child classes, just make a custom event that plugs into the functionality and have onclick call that event in the parent class, in each child class, instead of adding an onclick you can just override the custom event, then the onclick would automatically do it.
if you have something that all of the child classes need to do it needs to be setup in the parent class if you want to just call it quick and easy like hat