mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
ta, tabview, tileview, win: fix creating as screen. Closes #1363
This commit is contained in:
parent
dde953f0e2
commit
eb44a75bf6
@ -114,8 +114,17 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/* Set a size which fits into the parent.
|
||||
* Don't use `par` directly because if the tabview is created on a page it is moved to the
|
||||
* scrollable so the parent has changed */
|
||||
lv_obj_set_size(new_tabview, lv_obj_get_width_fit(lv_obj_get_parent(new_tabview)),
|
||||
lv_obj_get_height_fit(lv_obj_get_parent(new_tabview)));
|
||||
lv_coord_t w;
|
||||
lv_coord_t h;
|
||||
if(par) {
|
||||
w = lv_obj_get_width_fit(lv_obj_get_parent(new_tabview));
|
||||
h = lv_obj_get_height_fit(lv_obj_get_parent(new_tabview));
|
||||
} else {
|
||||
w = lv_disp_get_hor_res(NULL);
|
||||
h = lv_disp_get_ver_res(NULL);
|
||||
}
|
||||
|
||||
lv_obj_set_size(new_tabview, w, h);
|
||||
|
||||
ext->content = lv_cont_create(new_tabview, NULL);
|
||||
ext->btns = lv_btnm_create(new_tabview, NULL);
|
||||
|
@ -97,8 +97,17 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/* Set a size which fits into the parent.
|
||||
* Don't use `par` directly because if the tileview is created on a page it is moved to the
|
||||
* scrollable so the parent has changed */
|
||||
lv_obj_set_size(new_tileview, lv_obj_get_width_fit(lv_obj_get_parent(new_tileview)),
|
||||
lv_obj_get_height_fit(lv_obj_get_parent(new_tileview)));
|
||||
lv_coord_t w;
|
||||
lv_coord_t h;
|
||||
if(par) {
|
||||
w = lv_obj_get_width_fit(lv_obj_get_parent(new_tileview));
|
||||
h = lv_obj_get_height_fit(lv_obj_get_parent(new_tileview));
|
||||
} else {
|
||||
w = lv_disp_get_hor_res(NULL);
|
||||
h = lv_disp_get_ver_res(NULL);
|
||||
}
|
||||
|
||||
lv_obj_set_size(new_tileview, w, h);
|
||||
|
||||
lv_obj_set_drag_throw(lv_page_get_scrl(new_tileview), false);
|
||||
lv_page_set_scrl_fit(new_tileview, LV_FIT_TIGHT);
|
||||
|
@ -75,8 +75,17 @@ lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/* 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_win, lv_obj_get_width_fit(lv_obj_get_parent(new_win)),
|
||||
lv_obj_get_height_fit(lv_obj_get_parent(new_win)));
|
||||
lv_coord_t w;
|
||||
lv_coord_t h;
|
||||
if(par) {
|
||||
w = lv_obj_get_width_fit(lv_obj_get_parent(new_win));
|
||||
h = lv_obj_get_height_fit(lv_obj_get_parent(new_win));
|
||||
} else {
|
||||
w = lv_disp_get_hor_res(NULL);
|
||||
h = lv_disp_get_ver_res(NULL);
|
||||
}
|
||||
|
||||
lv_obj_set_size(new_win, w, h);
|
||||
|
||||
lv_obj_set_pos(new_win, 0, 0);
|
||||
lv_obj_set_style(new_win, &lv_style_pretty);
|
||||
|
Loading…
x
Reference in New Issue
Block a user