feathersui-openfl
feathersui-openfl copied to clipboard
Setting more PopupListView button properties on list selection change (not just text)
Looks like currently there's no easy way to control what PopupListView's button properties are changed when selection changes. For example, I'd like to change button icon to the currently selected item's image.
I found one way to achieve this via subclassing PopupListView and overriding refreshSelection, but it's not pretty, maybe a dynamic function similar to itemToText could be added to plug in the functionality without subclassing?
I should add something similar to what I did with ToggleSwitch. In the ToggleSwitch version of refreshSelection(), it toggles the internal skins, if possible:
if ((this._currentThumbSkin is IToggle)) {
cast(this._currentThumbSkin, IToggle).selected = this._selected;
}
if ((this._currentTrackSkin is IToggle)) {
cast(this._currentTrackSkin, IToggle).selected = this._selected;
}
if ((this._currentSecondaryTrackSkin is IToggle)) {
cast(this._currentSecondaryTrackSkin, IToggle).selected = this._selected;
}
In PopUpListView, I could do the same with the button. Then, if you use a ToggleButton, its skins could be customized for the selected states.