hey,
i having some issues with released notifiers from buttons inside a class instance, that call a function from an instance of a different class, which in return accesses the calling instance as well as other instances of the same class.
since this might sounds confusing, and one would ask why the f you would want to do that, i will try to explain what exactly is going on.
first, we have a class LEDButton which has a function get_control(properties) that returns a view, containing an “led” and a button, with the provided properties.
this class provides two modes of function: either it toggles the led itself (mode = “toggle”), then calls the released notifier, or it only calls the released notifier without changing the led’s state (mode = “manual”).
now we have a second class LEDButtonChooser, that is intended to turn a group of LEDButton instances into a radio button styled set.
this class has a function make_chooser(args), that expects a table led_buttons of all LEDButton instances and optionally the index value as argument (1 is default). furthermore, each LEDButton instance needs to include the function LEDButtonChooser:set_value(value) in its released notifier.
now the problem is: the LEDButton class should work flawlessly, i thoroughly tested it. unfortunately, the LEDButtonChooser class doesn’t work as intended, when the function LEDButtonChooser:set_value(value) is called from a released notifier of a button contained inside a LEDButton instance.
i tried hard to find the reason, but i guess it has to do with passing self. i really double-checked that every call uses “:”, so self should always get passed, but something goes wrong.
since the LEDButton class needs two icons for displaying the “led”, i will provide an example xrnx.
thanks a lot for your effort!