From 23c708b7876ac2601fbb866db99f57212e667d09 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 5 Oct 2014 17:20:05 +0200 Subject: [PATCH] CComponentsForm: fix unnecessary try for scroll This avoids unnecessary flicker effects, because no paint is required, if page count = 1 and also ensures, that this page is defined as current page. --- src/gui/components/cc_frm.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 29a7d1bc9..9237050b1 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -622,9 +622,14 @@ CComponentsItem* CComponentsForm::getSelectedItemObject() void CComponentsForm::ScrollPage(int direction, bool do_paint) { + if (getPageCount() == 1){ + cur_page = 0; + return; + } + OnBeforeScrollPage(); - int target_page_id = (int)getPageCount() - 1; + int target_page_id = (int)page_count - 1; int target_page = (int)cur_page; if (direction == SCROLL_P_DOWN)