VladimirMarkelov/clui

Missing OnActivate()

pdevine opened this issue · 2 comments

When a widget becomes active it would be nice to be able to set a callback function to be automatically called. An example use case would be when a button becomes active some help text automatically updates to explain what the button does.

Ideally this would be similar to the way OnClick() works and you could tie it directly to a widget.

BaseControl has a generic event func (c *BaseControl) OnActive(fn func(active bool)) { that is called when the control is ether activated or deactivated. Does it work for you?

The name may be not easy to guess, but OnActivate to me is not correct as well, since it also works as OnDeactivate.

Totally missed that! Yes, it works.