diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-07-17 13:38:44 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-07-17 13:38:44 +1000 |
| commit | d8ce31e46b0dea356dd415b62f71c265bea54d2a (patch) | |
| tree | d7b2062c25ecc2980147cdc5c297ce04ff60c4ad /lua/widgets.lua | |
| parent | 374bc5e734c230a1e9220d126eb401b478dcd571 (diff) | |
| download | tangara-fw-d8ce31e46b0dea356dd415b62f71c265bea54d2a.tar.gz | |
Scroll to top when selecting the back button
Diffstat (limited to 'lua/widgets.lua')
| -rw-r--r-- | lua/widgets.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lua/widgets.lua b/lua/widgets.lua index c7a24576..78d53a57 100644 --- a/lua/widgets.lua +++ b/lua/widgets.lua @@ -113,6 +113,16 @@ function widgets.StatusBar(parent, opts) local label = back:Label({ text = "<", align = lvgl.ALIGN.CENTER }) widgets.Description(label, "Back") back:onClicked(opts.back_cb) + back:onevent(lvgl.EVENT.FOCUSED, function() + local first_view = parent.content + if not first_view then return end + while first_view:get_child_cnt() > 0 do + first_view = first_view:get_child(0) + end + if first_view then + first_view:scroll_to_view_recursive(1) + end + end) end local title = root:Label { |
