let sliders and text always stretch to a grid cel, if used in a grid layout

add padding on the right side in grid layouts
This commit is contained in:
gagarinlg
2022-06-11 15:13:11 +02:00
committed by Raphael Coeffic
parent ee3f51330a
commit 1ab128e084
3 changed files with 6 additions and 0 deletions
+1
View File
@@ -46,6 +46,7 @@ class FlexGridLayout
// padding
lv_obj_set_style_pad_all(obj, padding, LV_PART_MAIN);
lv_obj_set_style_pad_left(obj, padding + PAGE_PADDING, LV_PART_MAIN);
lv_obj_set_style_pad_right(obj, padding + PAGE_PADDING, LV_PART_MAIN);
lv_obj_set_style_pad_row(obj, padding, LV_PART_MAIN);
// layout
+3
View File
@@ -93,6 +93,9 @@ Slider::Slider(Window* parent, const rect_t& rect, int32_t vmin, int32_t vmax,
lv_style_init(&style_edit);
lv_style_set_bg_color(&style_edit, makeLvColor(COLOR_THEME_EDIT));
lv_obj_add_style(lvobj, &style_edit, LV_PART_KNOB | LV_STATE_FOCUSED | LV_STATE_EDITED);
// always fill a grid cell in x-direction
lv_obj_set_style_grid_cell_x_align(lvobj, LV_GRID_ALIGN_STRETCH, 0);
}
+2
View File
@@ -41,6 +41,8 @@ StaticText::StaticText(Window* parent, const rect_t& rect, std::string txt,
lv_obj_set_style_bg_opa(lvobj, LV_OPA_100, LV_PART_MAIN);
setBackgroundColor(COLOR_THEME_SECONDARY2);
}
lv_obj_set_style_grid_cell_x_align(lvobj, LV_GRID_ALIGN_STRETCH, 0);
}
#if defined(DEBUG_WINDOWS)