hintbox: fix init order of setValue() and paint()

This commit is contained in:
2020-01-05 21:17:59 +01:00
parent 0c62e5e264
commit 54582340c6

View File

@@ -8,7 +8,7 @@
Copyright (C) 2008-2009, 2011, 2013 Stefan Seyfried Copyright (C) 2008-2009, 2011, 2013 Stefan Seyfried
Implementation of CComponent Window class. Implementation of CComponent Window class.
Copyright (C) 2014-2016 Thilo Graf 'dbt' Copyright (C) 2014-2019 Thilo Graf 'dbt'
License: GPL License: GPL
@@ -211,19 +211,21 @@ void CHintBox::enableTimeOutBar(bool enable)
delete timeout_pb_timer; timeout_pb_timer = NULL; delete timeout_pb_timer; timeout_pb_timer = NULL;
} }
if(timeout_pb){ if(timeout_pb){
timeout_pb->setValues(100, 100);
timeout_pb->paint0();
delete timeout_pb; timeout_pb = NULL; delete timeout_pb; timeout_pb = NULL;
} }
return; return;
} }
if(timeout_pb){ if(timeout_pb){
timeout_pb->paint0();
timeout_pb->setValues(timeout_pb->getValue()+1, 10*timeout); timeout_pb->setValues(timeout_pb->getValue()+1, 10*timeout);
timeout_pb->paint0();
}else{ }else{
timeout_pb = new CProgressBar(); timeout_pb = new CProgressBar();
timeout_pb->setType(CProgressBar::PB_TIMESCALE); timeout_pb->setType(CProgressBar::PB_TIMESCALE);
timeout_pb->setDimensionsAll(ccw_body->getRealXPos(), ccw_body->getRealYPos(), ccw_body->getWidth(), TIMEOUT_BAR_HEIGHT); timeout_pb->setDimensionsAll(ccw_body->getRealXPos(), ccw_body->getRealYPos(), ccw_body->getWidth(), TIMEOUT_BAR_HEIGHT);
timeout_pb->setValues(0, timeout); timeout_pb->setValues(timeout/10, timeout);
if (!timeout_pb_timer) { if (!timeout_pb_timer) {
timeout_pb_timer = new CComponentsTimer(100); timeout_pb_timer = new CComponentsTimer(100);
const string tn = cc_item_type.name + ":timeout_bar:"; const string tn = cc_item_type.name + ":timeout_bar:";