acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
lv_example_event_1.c (695B)
1 #include "../lv_examples.h" 2 #if LV_BUILD_EXAMPLES && LV_USE_SWITCH 3 4 static void event_cb(lv_event_t * e) 5 { 6 LV_LOG_USER("Clicked"); 7 8 static uint32_t cnt = 1; 9 lv_obj_t * btn = lv_event_get_target(e); 10 lv_obj_t * label = lv_obj_get_child(btn, 0); 11 lv_label_set_text_fmt(label, "%"LV_PRIu32, cnt); 12 cnt++; 13 } 14 15 /** 16 * Add click event to a button 17 */ 18 void lv_example_event_1(void) 19 { 20 lv_obj_t * btn = lv_btn_create(lv_scr_act()); 21 lv_obj_set_size(btn, 100, 50); 22 lv_obj_center(btn); 23 lv_obj_add_event_cb(btn, event_cb, LV_EVENT_CLICKED, NULL); 24 25 lv_obj_t * label = lv_label_create(btn); 26 lv_label_set_text(label, "Click me!"); 27 lv_obj_center(label); 28 } 29 30 #endif