TankOs/SFGUI — Issue #115: A More Robust Callback System?
Author: OniLink
Created: 2011-12-21 23:41:52+00:00
State: open

There's something that's been bothering me. The callback system, at the moment, feels rather... simple. In fact, it's simple to a fault. The problem I have with it is the fact that callbacks do not receive information on which instance of a widget is calling the callback. For example, lets say I have a bunch of entries, and I want all of them to only accept numeric values. I could create a callback that checks the text in the widget to see if any non-numeric values were entered, but then comes the problem of which entry had text entered into it? I could go through all of the entries, but that would lead to a ridiculous amount of unneeded processing. I could also create a separate callback for each widget, but that is also an absurd solution (especially in my case, where there is a variable number of entries). To resolve this, I propose adding a single parameter to the callbacks, which takes an sfg::Widget::Ptr.