@@ -59,14 +59,19 @@ def onResume(self, screen):
5959
6060# Create settings entries
6161screen .clean ()
62+ # Get the group for focusable objects
63+ focusgroup = lv .group_get_default ()
64+ if not focusgroup :
65+ print ("WARNING: could not get default focusgroup" )
66+
6267for setting in self .settings :
6368#print(f"setting {setting.get('title')} has changed_callback {setting.get('changed_callback')}")
6469# Container for each setting
6570setting_cont = lv .obj (screen )
6671setting_cont .set_width (lv .pct (100 ))
6772setting_cont .set_height (lv .SIZE_CONTENT )
6873setting_cont .set_style_border_width (1 ,0 )
69- setting_cont .set_style_border_side (lv .BORDER_SIDE .BOTTOM ,0 )
74+ # setting_cont.set_style_border_side(lv.BORDER_SIDE.BOTTOM, 0)
7075setting_cont .set_style_pad_all (mpos .ui .pct_of_display_width (2 ),0 )
7176setting_cont .add_flag (lv .obj .FLAG .CLICKABLE )
7277setting ["cont" ]= setting_cont # Store container reference for visibility control
@@ -84,9 +89,10 @@ def onResume(self, screen):
8489value .set_style_text_color (lv .color_hex (0x666666 ),0 )
8590value .set_pos (0 ,20 )
8691setting ["value_label" ]= value # Store reference for updating
87- setting_cont .add_event_cb (
88- lambda e ,s = setting :self .startSettingActivity (s ),lv .EVENT .CLICKED ,None
89- )
92+ setting_cont .add_event_cb (lambda e ,s = setting :self .startSettingActivity (s ),lv .EVENT .CLICKED ,None )
93+ setting_cont .add_event_cb (lambda e ,container = setting_cont :self .focus_container (container ),lv .EVENT .FOCUSED ,None )
94+ setting_cont .add_event_cb (lambda e ,container = setting_cont :self .defocus_container (container ),lv .EVENT .DEFOCUSED ,None )
95+ focusgroup .add_obj (setting_cont )
9096
9197def startSettingActivity (self ,setting ):
9298intent = Intent (activity_class = SettingActivity )
@@ -97,6 +103,17 @@ def startSettingActivity(self, setting):
97103def get_timezone_tuples ():
98104return [(tz ,tz )for tz in mpos .time .get_timezones ()]
99105
106+ def focus_container (self ,container ):
107+ print (f"container{ container } focused, setting border..." )
108+ container .set_style_border_color (lv .theme_get_color_primary (None ),lv .PART .MAIN )
109+ container .set_style_border_width (1 ,lv .PART .MAIN )
110+ container .scroll_to_view (lv .ANIM .ON )# scroll to bring it into view
111+
112+ def defocus_container (self ,container ):
113+ print (f"container{ container } defocused, unsetting border..." )
114+ container .set_style_border_width (0 ,lv .PART .MAIN )
115+
116+
100117# Used to edit one setting:
101118class SettingActivity (Activity ):
102119