Send a message on widget creation, resize, move

I want to send a message each time my widget is created, moved, resized etc. The message needs to contain some id or string for the widget, and a rectangle of the new bounds.

How can i send a message from the layout or draw method? Is there a better widget function to use for this kind of thing?

I figure this is the best way to work around the issue i posted here:

In the master branch and probably the next version there is the pop widget that lets you do that. Pop in iced::widget::pop - Rust

Great example, thats what i want to do… I cant use update() in my widget for some reason however…

From the pop.rs, there is an update function…

When i add the same function to my widget, i get the error:

error[E0407]: method `update` is not a member of trait `Widget`

I have the following, do i need to implement Theme to get the update function?

impl<'a, Message, Renderer> Widget<Message, Theme, Renderer> 
    for Key<'a, Message, Renderer>
where
    Renderer: 'a + iced::advanced::Renderer + iced::advanced::text::Renderer,
    Message: 'a + Clone,
{

/// .....

}

Yeah. The widget trait changed after the last release. The Pop widget is made using the latest dev version that has breaking changes.

You have two options:

  • use the latest dev version for your project → comes with the pop widget included
  • adapt the pop widget to use the old api if possible
  • wait for the last release

any idea when the next release is due?

Also a side note ive just noticed:
i’ve been using advanced renderer, for example:
Renderer: 'a + iced::advanced::Renderer + iced::advanced::text::Renderer,

Should i be using core?
Renderer: 'a + iced_core::Renderer + iced_core::text::Renderer,

I guess the next release is somewhere in the future, when the roadmap comes to version 0.14.
If I would need such a widget, I would just use the master branch until the next release is comes out and not wait for it.