Documentation Index
Fetch the complete documentation index at: https://mintlify.com/The-Young-Maker/OpenMenuOS/llms.txt
Use this file to discover all available pages before exploring further.
CustomScreen gives you a blank canvas and full control over what gets rendered. Use it any time you need a screen that goes beyond a list of menu items — data visualizations, about pages, status dashboards, or any bespoke UI layout that the built-in MenuScreen and SettingsScreen types can’t express.
When the user selects a CustomScreen item, the library calls your customDraw function every frame and renders the result. Pressing the select button returns to the previous screen automatically via the built-in handleInput() implementation.
Implementation flow
Declare the CustomScreen globally
Create the object at file scope, the same way you would declare a
MenuScreen.Set customDraw in setup()
Assign a lambda to
customScreen.customDraw inside setup(). The lambda captures whatever variables you need from the surrounding scope.customDraw must be assigned in setup(), not at global scope during object construction. At global initialization time, canvas and other library globals are not yet initialized, so drawing calls made there will have no effect or will crash.Link the screen to a MenuScreen
Add the
CustomScreen as a navigation target from any MenuScreen item.The global canvas object
All drawing in OpenMenuOS goes through thecanvas sprite, declared in the library header:
canvas is a TFT_eSprite backed by an off-screen buffer. The library composites canvas onto the physical display after every frame. Inside customDraw, you draw to canvas exactly as you would with any TFT_eSPI sprite.
Drawing primitives
The fullTFT_eSPI sprite API is available on canvas. Common primitives used inside customDraw:
drawSmoothRoundRect parameters: (x, y, outerRadius, innerRadius, width, height, fgColor, bgColor). Setting innerRadius to 0 produces a solid shape.
Accessing menu data inside customDraw
BecausecustomDraw is a lambda defined inside the sketch, it can access sketch-level globals directly — including the menu instance.
SettingsScreen:
Input handling
CustomScreen overrides handleInput() internally. The select button navigates back to the previous screen — no code required on your part. Encoder rotation and button presses for the up/down actions are not forwarded to customDraw; if you need to react to input from within a custom screen, trigger a popup or use a callback-based item on an intermediate MenuScreen instead.
Redirecting to a CustomScreen programmatically
If you need to navigate to aCustomScreen from a callback rather than through a menu item selection, use menu.redirectToScreen():