mirror of https://github.com/buggins/dlangui.git
Setting new items array must reset _selectedItemIndex to -1.
This commit is contained in:
parent
0cbf746cbc
commit
8edcc9a1e7
|
@ -225,6 +225,7 @@ class ComboBox : ComboBoxBase {
|
|||
}
|
||||
|
||||
@property void items(string[] itemResourceIds) {
|
||||
_selectedItemIndex = -1;
|
||||
setAdapter(new StringListAdapter(itemResourceIds));
|
||||
if(itemResourceIds.length > 0) {
|
||||
selectedItemIndex = 0;
|
||||
|
@ -233,6 +234,7 @@ class ComboBox : ComboBoxBase {
|
|||
}
|
||||
|
||||
@property void items(dstring[] items) {
|
||||
_selectedItemIndex = -1;
|
||||
setAdapter(new StringListAdapter(items));
|
||||
if(items.length > 0) {
|
||||
if (selectedItemIndex == -1 || selectedItemIndex > items.length)
|
||||
|
@ -242,6 +244,7 @@ class ComboBox : ComboBoxBase {
|
|||
}
|
||||
|
||||
@property void items(StringListValue[] items) {
|
||||
_selectedItemIndex = -1;
|
||||
if (auto a = cast(StringListAdapter)_adapter)
|
||||
a.items = items;
|
||||
else
|
||||
|
@ -369,6 +372,7 @@ class IconTextComboBox : ComboBoxBase {
|
|||
}
|
||||
|
||||
@property void items(StringListValue[] items) {
|
||||
_selectedItemIndex = -1;
|
||||
if (auto a = cast(IconStringListAdapter)_adapter)
|
||||
a.items = items;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue