lv_event_code_tcode =lv_event_get_code(e);// 获取当前部件(对象)触发的事件代码 lv_obj_t* label =lv_event_get_user_data(e);// 读取到标签对象 switch(code) { caseLV_EVENT_PRESSED:// 按下 lv_label_set_text(label,"The last button event:\nLV_EVENT_PRESSED"); break; caseLV_EVENT_...
sw = lv_switch_create(lv_scr_act()); 二、给其添加事件 首先定义回调函数 static void event_handler(lv_event_t * e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); if(code == LV_EVENT_VALUE_CHANGED) //当值切换时执行如下操作 { LV...
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_...
获取x轴坐标位置:lv_obj_get_x(obj);获取y轴坐标位置:lv_obj_get_y(obj); 4.4 对齐(Alignment) highlighter- reasonml 参照父对象对齐:lv_obj_set_align(obj, LV_ALIGN_...);参照父对象对齐后再设置坐标位置:lv_obj_align(obj, LV_ALIGN_...,x,y);参照另一个对象(无父子关系)对齐后设置坐标位置:l...
LV_EVENT_GET_SELF_SIZE,/**< Get the internal size of a widget*/ _LV_EVENT_LAST,/** Number of default events*/ LV_EVENT_PREPROCESS =0x80,/** This is a flag that can be set with an event so it's processed before the class default event processing */ ...
1.LV_EVENT_GESTURE事件的回调函数 这个lvgl的事件好像没什么可说的,直接上源码: static void albumpage_gesture_cb(lv_event_t * e) { lv_event_code_t event = lv_event_get_code(e); if(event == LV_EVENT_GESTURE) { // 等待触屏释放 ...
static void event_cb(lv_event_t * e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * label = lv_event_get_user_data(e); switch(code) { case LV_EVENT_PRESSED: lv_label_set_text(label, "The last button event:\nLV_EVENT_PRESSED"); ...
static void event_handler(lv_event_t * e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t * obj = lv_event_get_target(e); if(code == LV_EVENT_VALUE_CHANGED) { char buf[32]; lv_dropdown_get_selected_str(obj, buf, sizeof(buf)); ...
初始化显示器和创建用于绘图的缓冲区 lv_port_disp_init(); //找到 LittelvGL 支持的输入设备 lv_...
static void event_handler(lv_event_t * e) { static uint8_t status = 0 ; lv_event_code_t code = lv_event_get_code(e); if(code == LV_EVENT_CLICKED) { switch(status) { case0: lv_label_set_text(label,"こんにちは");