#Parent is the widget that has the
1 messages · Page 1 of 1 (latest)
Okay, so it's like
W_Panel
W_Buttons and when buttons are created they communicate to W_Panel
The delegate I have inside of the button and I call it on the buttons click
Delegate is Event Dispatcher?
Yes
Okay, so each button has it's own Delegate and On Click you Call Delegate
Then I just loop over an array of buttons, call their "set visual inactive" and then use the button that fired the event and set that to highlighted
Correct
but the looping is inside the button? you just add the same time call to the ''parent'' to get array of all buttons?
because each individual button needs info about how many buttons there are
The looping is inside of the parent, otherwise the buttons need to know about each other which is inconvinient imo
hmm, so what is blocking me on just moving literally everything to the parent ? like
This is in the button:
On Click -> <Get Parent> Set Button (this button as ref) > All logic here (get array, clear all highlight from buttons on complete set highlight on this button)
and that doesn't need event dispatcher? or i'm missing something
Set Button would be event inside Parent
Nothing ever stops you from just making shit public and doing it elsewhere, it makes sense in a few cases but a lot of times you put things where they make sense
On Click -> <Get Parent> Set Button (this button as ref) > All logic here (get array, clear all highlight from buttons on complete set highlight on this button)
The part that I use the event dispatcher for is getting a reference to the button that I need to highlight, if you can figure out a smart way go for that instead
This is just a quick way I've done it without it being complicated at all and very quick to implement
Ok, got it, i just associate event dispatchers with bindings the events and calling and i dont fully get the concept, hoped this would be iexample iwould I got it, but I guess it's more like a concept of delegates and not really event dispatcher thing used to the fullest