Skip to content

Commit

Permalink
Merge pull request #104 from Shallowmallow/MultipleListView
Browse files Browse the repository at this point in the history
setter for selectedIndexes in ListCtrl
  • Loading branch information
ianharrigan authored Jan 31, 2024
2 parents 388bdac + f8883b9 commit 3cc50cf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/hx/widgets/ListCtrl.hx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class ListCtrl extends Control {
}

// sugar
public var selectedIndexes(get, null):Array<Int>;
public var selectedIndexes(get, set):Array<Int>;
private function get_selectedIndexes():Array<Int> {
var indexes:Array<Int> = [];

Expand All @@ -132,6 +132,15 @@ class ListCtrl extends Control {

return indexes;
}
private function set_selectedIndexes(value:Array<Int>):Array<Int> {
for (i in selectedIndexes) {
setItemState(i, 0, ListState.SELECTED);
}
for (i in value) {
setItemState(i, ListState.SELECTED, ListState.SELECTED);
}
return value;
}

public var selectedIndex(get, set):Int;
private function get_selectedIndex():Int {
Expand Down

0 comments on commit 3cc50cf

Please sign in to comment.