How do I obtain a refernce to widgets in Relm4 Component?

I’m building an app using the Relm4 SimpleComponent / Component macro. It works great. But I don’t understand how can I refer to the generated GTK widgets later?

My understanding is that the update_view() method is automatically handled by the Component, so I can’t really use it.
I know I have access to the generated widgets in init() fn using:

let widgets = view_output!();

But what if I need those widgets later, for example in the event handlers in update() fn or in the post_view() fn or elsewhere?

I’m new to Relm4 and Rust, so probably there is some simple solution, but I can’t see how this is supposed to work.

Leave a Comment