Rect (Geometry) Widget Example

Demonstrates the Rect geometry primitive and hit-testing patterns.

TUI layouts are composed of rectangles. Understanding how to manipulate Rect objects, reuse them from the layout phase, and use them for mouse interaction is critical for building interactive apps.

Features Demonstrated

Hotkeys

Usage

ruby examples/widget_rect/app.rb

Learning Outcomes

Use this example if you need to… - Handle mouse clicks on specific buttons or areas. - Create resizable panes (like a split pane in an IDE). - Debug layout issues by inspecting Rect coordinates.

Demo