Base Widget

Report on GitHub

The lv_obj_t base class that every other widget inherits from, usable directly as a container or styling surface.

Obj bind style (theme toggle)

Apply a named style only when a subject equals a reference value.

The "dark" style is attached to the panel via <bind_style> with subject="subject_flag" and ref_value="1": it's applied whenever subject_flag is 1 and removed otherwise. The toggle button flips subject_flag through subject_toggle_event. This is the canonical "binding-driven theme switch" pattern — no event callback in user code.

Draggable base object

Move a Drag me object under the pointer using LV_EVENT_PRESSING.

A 150 by 100 base object carries a centered Drag me label. An LV_EVENT_PRESSING callback reads the active input device's motion vector with lv_indev_get_vect, adds it to the object's current aligned position, and calls lv_obj_set_pos so the object follows the pointer as long as it is held down.

Animated matrix transform on a base object

Continuously scale and rotate a centered object using lv_obj_set_transform.

A centered base object is paired with a 20 ms lv_timer that builds an identity lv_matrix_t, scales its x axis, rotates it by 360 times the scale factor, and applies the result with lv_obj_set_transform. The scale factor grows from 0.1 to 2.0 in 0.01 steps; once it exceeds 2.0 the object is reset with lv_obj_reset_transform and the loop restarts.

Last updated on

On this page