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_roller_1.c (1227B)
1 #include "../../lv_examples.h" 2 #if LV_USE_ROLLER && LV_BUILD_EXAMPLES 3 4 static void event_handler(lv_event_t * e) 5 { 6 lv_event_code_t code = lv_event_get_code(e); 7 lv_obj_t * obj = lv_event_get_target(e); 8 if(code == LV_EVENT_VALUE_CHANGED) { 9 char buf[32]; 10 lv_roller_get_selected_str(obj, buf, sizeof(buf)); 11 LV_LOG_USER("Selected month: %s\n", buf); 12 } 13 } 14 15 /** 16 * An infinite roller with the name of the months 17 */ 18 void lv_example_roller_1(void) 19 { 20 lv_obj_t * roller1 = lv_roller_create(lv_scr_act()); 21 lv_roller_set_options(roller1, 22 "January\n" 23 "February\n" 24 "March\n" 25 "April\n" 26 "May\n" 27 "June\n" 28 "July\n" 29 "August\n" 30 "September\n" 31 "October\n" 32 "November\n" 33 "December", 34 LV_ROLLER_MODE_INFINITE); 35 36 lv_roller_set_visible_row_count(roller1, 4); 37 lv_obj_center(roller1); 38 lv_obj_add_event_cb(roller1, event_handler, LV_EVENT_ALL, NULL); 39 } 40 41 #endif