# Base Widget (/examples/widgets/obj)



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) [#obj-bind-style-theme-toggle]

<LvglExampleBrief>
  Apply a named style only when a subject equals a reference value.
</LvglExampleBrief>

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.

<LvglExample name="lv_example_obj_bind_style" path="widgets/obj/lv_example_obj_bind_style" />

Draggable base object [#draggable-base-object]

<LvglExampleBrief>
  Move a 

  `Drag me`

   object under the pointer using 

  `LV_EVENT_PRESSING`

  .
</LvglExampleBrief>

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.

<LvglExample name="lv_example_obj_draggable" path="widgets/obj/lv_example_obj_draggable" />

Animated matrix transform on a base object [#animated-matrix-transform-on-a-base-object]

<LvglExampleBrief>
  Continuously scale and rotate a centered object using 

  `lv_obj_set_transform`

  .
</LvglExampleBrief>

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.

<LvglExample name="lv_example_obj_transform" path="widgets/obj/lv_example_obj_transform" />
