CComponentsExtTextForm: fix label width calculation

This commit is contained in:
2017-03-15 09:37:55 +01:00
parent 1db1182b87
commit 81cde4836f
2 changed files with 3 additions and 5 deletions

View File

@@ -86,8 +86,7 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p
width = w;
//init ccx_label_width and ccx_text_width
//default ccx_label_width = 30% of form width
ccx_percent_label_w = DEF_LABEL_WIDTH_PERCENT;
ccx_label_width = ccx_percent_label_w * width/100;
ccx_label_width = DEF_LABEL_WIDTH_PERCENT * width/100;
ccx_text_width = width-ccx_label_width;
height = h;
@@ -223,7 +222,8 @@ void CComponentsExtTextForm::initCCTextItems()
void CComponentsExtTextForm::setLabelWidthPercent(const uint8_t& percent_val)
{
ccx_percent_label_w = (int)percent_val;
ccx_label_width = (int)percent_val * width/100;
ccx_text_width = width-ccx_label_width;
initCCTextItems();
}

View File

@@ -49,8 +49,6 @@ class CComponentsExtTextForm : public CComponentsForm, public CCTextScreen
int ccx_text_width;
///property: font type of both items (label and text), see also setLabelAndText()
Font* ccx_font;
///property: percentage val of label width related to full width, causes fit of text automatically into the available remaining size of item, see also setLabelWidthPercent()
uint8_t ccx_percent_label_w;
///centered y position of label and text
int y_text;