@@ -29,6 +29,12 @@ lv_group_t *loader_group;
29
29
pthread_t loader_thread ;
30
30
lv_obj_t * loader_msgbox = NULL ;
31
31
32
+ void on_focus (lv_event_t * e )
33
+ {
34
+ lv_obj_t * obj = lv_event_get_current_target (e );
35
+ lv_obj_scroll_to_view_recursive (lv_obj_get_parent (obj ), LV_ANIM_ON );
36
+ }
37
+
32
38
void loader_cancel_button_cb (lv_event_t * e ) {
33
39
printf ("Cancelling loader thread\n" );
34
40
@@ -291,6 +297,7 @@ lv_obj_t * create_slider(lv_obj_t * parent, const char * icon, const char * txt,
291
297
lv_obj_add_style (slider , & style_openipc , LV_STATE_FOCUS_KEY );
292
298
293
299
lv_obj_add_event_cb (slider , slider_event_cb , LV_EVENT_ALL , slider_label );
300
+ lv_obj_add_event_cb (slider , on_focus , LV_EVENT_FOCUSED , NULL );
294
301
295
302
thread_data_t * data = malloc (sizeof (thread_data_t ));
296
303
if (data ) {
@@ -326,6 +333,8 @@ lv_obj_t * create_button(lv_obj_t * parent, const char * txt)
326
333
327
334
lv_obj_add_style (btn , & style_openipc_outline , LV_PART_MAIN | LV_STATE_FOCUS_KEY );
328
335
lv_obj_add_event_cb (btn , back_event_handler , LV_EVENT_KEY ,NULL );
336
+ lv_obj_add_event_cb (btn , on_focus , LV_EVENT_FOCUSED , NULL );
337
+
329
338
330
339
return obj ;
331
340
}
@@ -416,6 +425,8 @@ lv_obj_t * create_switch(lv_obj_t * parent, const char * icon, const char * txt,
416
425
}
417
426
418
427
lv_obj_add_event_cb (sw , back_event_handler , LV_EVENT_KEY ,NULL );
428
+ lv_obj_add_event_cb (sw , on_focus , LV_EVENT_FOCUSED , NULL );
429
+
419
430
420
431
return obj ;
421
432
}
@@ -478,6 +489,7 @@ lv_obj_t * create_dropdown(lv_obj_t * parent, const char * icon, const char * la
478
489
479
490
lv_obj_add_event_cb (dd , generic_dropdown_event_cb , LV_EVENT_VALUE_CHANGED ,data );
480
491
lv_obj_add_event_cb (dd , back_event_handler , LV_EVENT_KEY ,NULL );
492
+ lv_obj_add_event_cb (dd , on_focus , LV_EVENT_FOCUSED , NULL );
481
493
482
494
get_dropdown_value (obj );
483
495
0 commit comments