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_dropdown_1.c (1026B)
1 #include "../../lv_examples.h" 2 #if LV_USE_DROPDOWN && 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_dropdown_get_selected_str(obj, buf, sizeof(buf)); 11 LV_LOG_USER("Option: %s", buf); 12 } 13 } 14 15 void lv_example_dropdown_1(void) 16 { 17 18 /*Create a normal drop down list*/ 19 lv_obj_t * dd = lv_dropdown_create(lv_scr_act()); 20 lv_dropdown_set_options(dd, "Apple\n" 21 "Banana\n" 22 "Orange\n" 23 "Cherry\n" 24 "Grape\n" 25 "Raspberry\n" 26 "Melon\n" 27 "Orange\n" 28 "Lemon\n" 29 "Nuts"); 30 31 lv_obj_align(dd, LV_ALIGN_TOP_MID, 0, 20); 32 lv_obj_add_event_cb(dd, event_handler, LV_EVENT_ALL, NULL); 33 } 34 35 #endif