Skip to content

Commit a8939ec

Browse files
Fix ListBox not updating its scrollbars when changing items
1 parent 825b2aa commit a8939ec

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/SFGUI/ListBox.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ void ListBox::AppendItem( const sf::String& str ) {
7474

7575
UpdateDisplayedItems();
7676
RequestResize();
77+
HandleSizeChange();
7778
Invalidate();
7879
}
7980

@@ -97,6 +98,7 @@ void ListBox::InsertItem( IndexType index, const sf::String& str ) {
9798

9899
UpdateDisplayedItems();
99100
RequestResize();
101+
HandleSizeChange();
100102
Invalidate();
101103
}
102104

@@ -117,6 +119,7 @@ void ListBox::PrependItem( const sf::String& str ) {
117119

118120
UpdateDisplayedItems();
119121
RequestResize();
122+
HandleSizeChange();
120123
Invalidate();
121124
}
122125

@@ -126,6 +129,9 @@ void ListBox::ChangeItem( IndexType index, const sf::String& str ) {
126129
}
127130

128131
m_items[ static_cast<std::size_t>( index ) ] = str;
132+
133+
UpdateDisplayedItems();
134+
Invalidate();
129135
}
130136

131137
void ListBox::RemoveItem( IndexType index ) {
@@ -155,6 +161,7 @@ void ListBox::RemoveItem( IndexType index ) {
155161

156162
UpdateDisplayedItems();
157163
RequestResize();
164+
HandleSizeChange();
158165
Invalidate();
159166
}
160167

@@ -164,6 +171,7 @@ void ListBox::Clear() {
164171

165172
UpdateDisplayedItems();
166173
RequestResize();
174+
HandleSizeChange();
167175
Invalidate();
168176
}
169177

@@ -433,6 +441,8 @@ void ListBox::HandleSizeChange() {
433441
UpdateScrollbarAllocation();
434442

435443
UpdateDisplayedItemsText();
444+
445+
Invalidate();
436446
}
437447

438448
bool ListBox::HandleAdd( Widget::Ptr widget ) {

0 commit comments

Comments
 (0)