From 7f59aac8bb93a782b683668f2322f6c8a15abd75 Mon Sep 17 00:00:00 2001 From: philmoz Date: Sun, 24 Sep 2023 07:26:04 +1000 Subject: [PATCH] Fix size of id & instance fields on sensor edit page for portrait layout. --- radio/src/gui/colorlcd/model_telemetry.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/radio/src/gui/colorlcd/model_telemetry.cpp b/radio/src/gui/colorlcd/model_telemetry.cpp index 74879353dfa..5c6ac08100e 100644 --- a/radio/src/gui/colorlcd/model_telemetry.cpp +++ b/radio/src/gui/colorlcd/model_telemetry.cpp @@ -604,13 +604,21 @@ class SensorEditWindow : public Page { paramLines[P_ID] = form->newLine(&grid2); new StaticText(paramLines[P_ID], rect_t{}, STR_ID, 0, COLOR_THEME_PRIMARY1); - auto hex = new NumberEdit(paramLines[P_ID], rect_t{}, 0, 0xFFFF, GET_SET_DEFAULT(sensor->id)); - hex->setDisplayHandler([](int32_t value) { + auto num = new NumberEdit(paramLines[P_ID], rect_t{}, 0, 0xFFFF, GET_SET_DEFAULT(sensor->id)); +#if LCD_H > LCD_W + // Portrait layout - need to limit width of edit box + num->setWidth((lv_pct(28))); +#endif + num->setDisplayHandler([](int32_t value) { std::stringstream stream; stream << std::hex << value; return stream.str(); }); - new NumberEdit(paramLines[P_ID], rect_t{}, 0, 0xff, GET_SET_DEFAULT(sensor->instance)); + num = new NumberEdit(paramLines[P_ID], rect_t{}, 0, 0xff, GET_SET_DEFAULT(sensor->instance)); +#if LCD_H > LCD_W + // Portrait layout - need to limit width of edit box + num->setWidth(lv_pct(28)); +#endif paramLines[P_UNIT] = form->newLine(&grid); new StaticText(paramLines[P_UNIT], rect_t{}, STR_UNIT, 0, COLOR_THEME_PRIMARY1);