I’m building a UI widget with a fair number of buttons and I’ve hit a scaling problem I can’t find a clean answer to.
For events this works nicely: instead of one event variable per button, I use a single event variable and pass a parameter equal to the button index. Four buttons, one handler, no duplication.
Color and message variables don’t seem to support that. As far as I can tell I can’t attach a parameter to them in the widget, which means one color variable and one message variable per button. With four buttons that’s already 8 variables, and on a larger UI it becomes unmanageable.
So my question: is there a clean pattern for this, that is similar to using parameters?
Thanks.