Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(color): allow all UI controls for widgets when full screen #5808

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

philmoz
Copy link
Collaborator

@philmoz philmoz commented Jan 20, 2025

Extends the Lua LVGL API to allow buttons, text and number edit, sliders etc to be used on widgets when the widget is in full screen mode.

Example widget script:

local opts = {
}

local wgt
local exitApp = false

local function create(zone, opts)
  wgt = { zone=zone, opts=opts }
  return wgt
end

local function update(wgt, opts)
  wgt.opts = opts
  exitApp = false

  if lvgl == nil then return end

  lvgl.clear()

  local lyt

  if (lvgl.isFullscreen()) then
    lyt = {
      {type="button", text="Close", x=100, y=100,
          press=(
              function()
                  lvgl.confirm({title="Exit", message="Really exit?",
                      confirm=(function() exitApp = true end)
                  })
              end)},
    }
  else
    lyt = {
      {type="label", text="Enter full screen for UI", x=100, y=100},
    }
  end

  lvgl.build(lyt)
end

local function background(wgt)
end

local function refresh(wgt, event, touchState)
  if (exitApp) then
    lcd.exitFullScreen()
  end

  if lvgl == nil then
    lcd.drawText(0, 0, "Lvgl support required", COLOR_THEME_WARNING)
  end
end

return { name="Lvgl App", options=opts, create=create, update=update, refresh=refresh, background=background, useLvgl=true }

@philmoz philmoz added enhancement ✨ New feature or request color Related generally to color LCD radios lua-api Lua API related labels Jan 20, 2025
@philmoz philmoz added this to the 2.11 milestone Jan 20, 2025
@philmoz philmoz changed the title feat(color): allow all UI for App Mode widgets when full screen. feat(color): allow all UI controls for widgets when full screen. Jan 20, 2025
@philmoz philmoz marked this pull request as draft January 20, 2025 23:26
@pfeerick pfeerick changed the title feat(color): allow all UI controls for widgets when full screen. feat(color): allow all UI controls for widgets when full screen Jan 21, 2025
@philmoz philmoz marked this pull request as ready for review January 21, 2025 02:26
@philmoz philmoz force-pushed the philmoz/lua-lvgl-app-mode branch from 290d2f7 to d5f3c42 Compare January 21, 2025 08:35
@philmoz philmoz force-pushed the philmoz/lua-lvgl-app-mode branch from 731932e to 8f861ec Compare January 22, 2025 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
color Related generally to color LCD radios enhancement ✨ New feature or request lua-api Lua API related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant