Skip to main content

component_from_event

Function component_from_event 

Source
pub unsafe fn component_from_event(e: *mut lv_event_t) -> *mut c_void
Expand description

Walk up from the event’s target through the parent chain looking for any non-null user_data pointer, returning the first one found.

Used by Component-style patterns to recover the owning component instance from inside an event callback. The caller must cast the returned pointer to the correct type.

§Safety

e must be a valid lv_event_t * active inside an event callback. The returned pointer is whatever the widget tree’s user_data holds — the caller is responsible for its type.