ScreenSaver: ScrollToSelection off-by-one

For some reason calling PopulateScreenSaver() list in AllAttached()
scrolls the selection off-by-one, so, call PopulateScreenSaverList()
in AttachedToWindow() and then call ScrollToSelection() again in
AllAttached() which seems to fix the problem.
This commit is contained in:
John Scipione
2013-09-10 18:46:09 -04:00
parent 5041c8ae6e
commit fb90f7ffe4
@@ -583,6 +583,8 @@ ModulesView::DetachedFromWindow()
void void
ModulesView::AttachedToWindow() ModulesView::AttachedToWindow()
{ {
PopulateScreenSaverList();
fScreenSaversListView->SetTarget(this); fScreenSaversListView->SetTarget(this);
fTestButton->SetTarget(this); fTestButton->SetTarget(this);
fAddButton->SetTarget(this); fAddButton->SetTarget(this);
@@ -592,7 +594,8 @@ ModulesView::AttachedToWindow()
void void
ModulesView::AllAttached() ModulesView::AllAttached()
{ {
PopulateScreenSaverList(); fScreenSaversListView->ScrollToSelection();
// This only works after the list view is attached
fScreenSaversListView->Invoke(new BMessage(kMsgSaverSelected)); fScreenSaversListView->Invoke(new BMessage(kMsgSaverSelected));
} }