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 to draw anything you like — text, shapes, images, sensor readings — using the full TFT_eSPI sprite API. You assign a drawing function (or lambda) to the customDraw property, and the library calls it automatically whenever the screen needs to be rendered. Pressing SELECT on a CustomScreen navigates back to the previous screen.
Constructors
CustomScreen()
Creates a custom screen without a title.
CustomScreen(const char* title)
Creates a custom screen with a title. The title is used as the item label when you add this screen to a MenuScreen via addItem(Screen*).
Title string for this screen.
Properties
customDraw
Type: std::function<void()>
The drawing function called every time the screen renders. Assign a lambda or a regular function pointer here. Inside the function, draw directly to the global canvas (TFT_eSprite) object — the library automatically pushes the canvas to the physical display after customDraw returns.
customDraw must be assigned before menu.begin() is called, typically near the top of setup(). Assigning it after begin() is safe but the screen will render a blank frame on its first draw call.title
Type: const char*
The title string provided to the constructor. Read-only at runtime.
Methods
draw()
Renders the screen by invoking customDraw if it is set. Called automatically by the library — you do not need to call it directly.
handleInput()
Processes user input for this screen. Pressing SELECT returns to the previous screen via back navigation. Called automatically inside menu.loop().
The global canvas object
Inside customDraw, you draw to the global TFT_eSprite canvas object that is declared in OpenMenuOS.h:
canvas is a sprite the same size as the display. Use any TFT_eSprite drawing method — fillScreen, drawString, fillCircle, drawRect, pushImage, etc. The library calls drawCanvasOnTFT() after customDraw returns to push the sprite to the physical display.
Complete example
The following is thecustomDraw assignment from the official example sketch, showing geometric shapes and a version string drawn to the canvas:
CustomScreen programmatically from an action callback: