Skip to content

Commit

Permalink
Apply Guichan's changes from 6725f3b08248d94e3ac11ce530aec42e3029fc62…
Browse files Browse the repository at this point in the history
… (Sept 14th 2008)

A bug prevented scroll area from scrolling a list box correctly. It was caused by the fact that list box called Widget::showPart on every logic call to fix it's scroll when a user goes up and down the list which caused the scroll areas scroll to be ignored. The problem has been fixed by only calling Widget::showPart when a new item in the list box has been selected.
  • Loading branch information
Jarod42 committed Sep 4, 2024
1 parent ca48408 commit abe55ac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* Continue rebasing from 6725f3b08248d94e3ac11ce530aec42e3029fc62
* Continue rebasing from 840e2ea3b13eb24057b8505eaa615d4e6bd363c6
* Add a focus listener interface.
* Make focus apply synchronously.
* Graphics and input objects for DirectX.
Expand Down
27 changes: 13 additions & 14 deletions src/widgets/listbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,6 @@ namespace gcn
void ListBox::logic()
{
adjustSize();

Rectangle scroll;

if (mSelected < 0)
{
scroll.y = 0;
}
else
{
scroll.y = getRowHeight() * mSelected;
}

scroll.height = getRowHeight();
showPart(scroll);
}

int ListBox::getSelected() const
Expand Down Expand Up @@ -211,6 +197,19 @@ namespace gcn
mSelected = selected;
}
}
Rectangle scroll;

if (mSelected < 0)
{
scroll.y = 0;
}
else
{
scroll.y = getRowHeight() * mSelected;
}

scroll.height = getRowHeight();
showPart(scroll);

distributeValueChangedEvent();
}
Expand Down

0 comments on commit abe55ac

Please sign in to comment.