From 0892cbadc480738dedf7a58589fe73c340200184 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sat, 27 Apr 2019 19:26:49 +0200 Subject: [PATCH] kb: set the size to screen by default --- src/lv_objx/lv_kb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lv_objx/lv_kb.c b/src/lv_objx/lv_kb.c index 10a34951c..a5dd73f84 100644 --- a/src/lv_objx/lv_kb.c +++ b/src/lv_objx/lv_kb.c @@ -118,7 +118,12 @@ lv_obj_t * lv_kb_create(lv_obj_t * par, const lv_obj_t * copy) /*Init the new keyboard keyboard*/ if(copy == NULL) { - lv_obj_set_size(new_kb, LV_DPI * 3, LV_DPI * 2); + /* Set a size which fits into the parent. + * Don't use `par` directly because if the window is created on a page it is moved to the + * scrollable so the parent has changed */ + lv_obj_set_size(new_kb, lv_obj_get_width_fit(lv_obj_get_parent(new_kb)), + lv_obj_get_height_fit(lv_obj_get_parent(new_kb))); + lv_obj_align(new_kb, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0); lv_obj_set_event_cb(new_kb, lv_kb_def_event_cb); lv_btnm_set_map(new_kb, kb_map_lc);