fix: follow changes of lvgl in examples and extra widgets

This commit is contained in:
Gabor Kiss-Vamosi
2021-02-24 10:00:54 +01:00
parent 0aff24505e
commit a2b29c091f
6 changed files with 17 additions and 17 deletions

View File

@@ -16,14 +16,15 @@ static void sw_event_cb(lv_obj_t * sw, lv_event_t e)
*/
void lv_example_scroll_2(void)
{
lv_obj_t * list = lv_obj_create(lv_scr_act(), NULL);
lv_obj_set_size(list, 280, 150);
lv_obj_set_scroll_snap_x(list, LV_SCROLL_SNAP_CENTER);
lv_obj_set_layout(list, &lv_flex_queue);
lv_obj_t * panel = lv_obj_create(lv_scr_act(), NULL);
lv_obj_set_size(panel, 280, 150);
lv_obj_set_scroll_snap_x(panel, LV_SCROLL_SNAP_CENTER);
lv_obj_set_layout(panel, &lv_flex_queue);
lv_obj_center(panel);
uint32_t i;
for(i = 0; i < 10; i++) {
lv_obj_t * btn = lv_btn_create(list, NULL);
lv_obj_t * btn = lv_btn_create(panel, NULL);
lv_obj_clear_flag(btn, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /* It does similar thing than snapping so disable it.*/
lv_obj_set_size(btn, 150, 100);
@@ -37,16 +38,15 @@ void lv_example_scroll_2(void)
lv_obj_center(label);
}
lv_obj_update_snap(list, LV_ANIM_ON);
lv_obj_update_snap(panel, LV_ANIM_ON);
/*Switch between "One scroll" and "Normal scroll" mode*/
lv_obj_t * sw = lv_switch_create(lv_scr_act(), NULL);
lv_obj_align(sw, NULL, LV_ALIGN_IN_TOP_RIGHT, -20, 10);
lv_obj_add_event_cb(sw, sw_event_cb, list);
lv_obj_add_event_cb(sw, sw_event_cb, panel);
lv_obj_t * label = lv_label_create(lv_scr_act(), NULL);
lv_label_set_text(label, "One scroll");
lv_obj_align(label, sw, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
lv_obj_align(label, sw, LV_ALIGN_OUT_BOTTOM_MID, 0, 5);
}
#endif

View File

@@ -6,7 +6,7 @@ static void btnm_event_handler(lv_obj_t * obj, lv_event_t event)
{
if(event == LV_EVENT_VALUE_CHANGED) {
lv_obj_t * ta = lv_event_get_user_data();
const char * txt = lv_btnmatrix_get_btn_text(obj, lv_btnmatrix_get_active_btn(obj));
const char * txt = lv_btnmatrix_get_btn_text(obj, lv_btnmatrix_get_selected_btn(obj));
if(strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) lv_textarea_del_char(ta);
else if(strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) lv_textarea_add_char(ta, '\n');