feathersui-openfl icon indicating copy to clipboard operation
feathersui-openfl copied to clipboard

Setting more PopupListView button properties on list selection change (not just text)

Open nadako opened this issue 3 years ago • 0 comments

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?

nadako avatar Jun 22 '22 13:06 nadako

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.

joshtynjala avatar Jun 22 '22 15:06 joshtynjala