lv_obj_t * obj = lv_event_get_target(e); if(code == LV_EVENT_VALUE_CHANGED) //当值切换时执行如下操作 { LV_LOG_USER("State: %s\n", lv_obj_has_state(obj, LV_STATE_CHECKED) ? "On" : "Off"); } } 然后给OBJ添加该回调函数即可 lv_obj_add_event_cb(sw, event_handler, LV_E...
lv_obj_add_event_cb(btn01, button_simple_cb, LV_EVENT_CLICKED, label01); 这里让按钮只对点击事件产生响应。如果要让按钮对多个事件响应的话,需要先让按钮对所有事件LV_EVENT_ALL产生响应的话,然后在回调函数内进一步判断事件类型: lv_event_code_tcode =lv_event_get_code(e);if(code == LV_EVENT_...
lv_event_code_tcode = lv_event_get_code(e);// 获取事件编码 lv_obj_t* ta = lv_event_get_target(e);// 获取文本对象 lv_obj_t* kb = (lv_obj_t*)lv_event_get_user_data(e);// 获取键盘对象 /* 获取文本点击事件 */ if(code == LV_EVENT_CLICKED) { lv_keyboard_set_textarea(kb...
This bug will be fixed in GUI Guider v1.4.0. the following code can be used in events_init.c is the workaround. static void Screen_btn_screen_to_screen2_event_handler(lv_event_t *e){ lv_event_code_t code = lv_event_get_code(e); ...
if(lv_event_get_code(e) == LV_EVENT_SCROLL_BEGIN) { lv_anim_t * a = lv_event_get_param(e); if(a) a->time = 0; } } void lv_example_tabview_2(void) { /*Create a Tab view object*/ lv_obj_t *tabview; tabview = lv_tabview_create(lv_scr_act(), LV_DIR_LEFT, 80)...
static void lv_textarea_event(const lv_obj_class_t * class_p, lv_event_t * e) { LV_UNUSED(class_p); lv_res_t res; /*Call the ancestor's event handler*/ res = lv_obj_event_base(MY_CLASS, e); if(res != LV_RES_OK) return; lv_event_code_t code = lv_event_get...
Introduce the problem In a touch screen scenario, the user presses a button, but the user expects no LV_EVENT_CLICKED to be generated after moving the finger. Examples and cases Although I can add a piece of code like the following to ea...
I found that the code always gets stuck at lv_event_send(obj, LV_EVENT_DRAW_MAIN, draw_ctx), and ultimately, it gets stuck at lv_draw_sw_rect. The call process of lv_draw_sw_rect is as follows:The program stuck in vg_lite_finish() in the function lv_event_send(obj,...
#define LV_LOG_TRACE_EVENT 1 #define LV_LOG_TRACE_OBJ_CREATE 1 #define LV_LOG_TRACE_LAYOUT 1 #define LV_LOG_TRACE_ANIM 1 #define LV_LOG_TRACE_CACHE 1 #endif /*LV_USE_LOG*/ /*--- * Asserts *---*/ /*Enable asserts if an operation is failed or an invalid data...
static void MUSIC_event_handler(lv_event_t * e)//菜单界面触发音乐 { lv_event_code_t code = lv_event_get_code(e); if(code == LV_EVENT_CLICKED) { lv_obj_add_flag(contanier1, LV_OBJ_FLAG_HIDDEN); lv_obj_clear_flag(contanier2, LV_OBJ_FLAG_HIDDEN); } } static void SETTINGS_...