From 2d1cf8e5a8309389fa2b5d7e0f3db6ab896273a3 Mon Sep 17 00:00:00 2001 From: philmoz Date: Fri, 12 Dec 2025 13:34:28 +1100 Subject: [PATCH] fix(color): number edit control does not size properly when width set to a percentage (#6870) --- radio/src/gui/colorlcd/libui/numberedit.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/radio/src/gui/colorlcd/libui/numberedit.cpp b/radio/src/gui/colorlcd/libui/numberedit.cpp index 2b094e6a3..1c67ef220 100644 --- a/radio/src/gui/colorlcd/libui/numberedit.cpp +++ b/radio/src/gui/colorlcd/libui/numberedit.cpp @@ -214,11 +214,15 @@ NumberEdit::NumberEdit(Window* parent, const rect_t& rect, int vmin, int vmax, vmin(vmin), vmax(vmax) { - if (rect.w == 0) setWidth(EdgeTxStyles::EDIT_FLD_WIDTH); + if (rect.w == 0 || rect.w == LV_SIZE_CONTENT) setWidth(EdgeTxStyles::EDIT_FLD_WIDTH); setTextFlag(textFlags); - lv_obj_set_width(label, width() - PAD_MEDIUM * 2 - 2); + padLeft(PAD_MEDIUM); + padRight(PAD_SMALL); + + lv_obj_set_width(label, LV_PCT(100)); + if (textFlags & CENTERED) etx_obj_add_style(label, styles->text_align_center, LV_PART_MAIN); else