Skip to content
Discussion options

You must be logged in to vote

Maybe you want to do somehing like:



export global ImageSource {
   pure callback generate_image(length, length, string) -> image;
}

export component Example {
  VerticalBox {
    Rectangle {
        Image {
            x: 0px; y: 0px; // ensure there is no binding loop
            width: 100%; height: 100%;
            source: ImageSource.generate_image(self.width, self.height, "maybe_some_id_here");
        }
    }
    Button {
        text: "Some other functionalities";
    }
  }
}

The Rectangle layer of indirection ensure there are no binding loop.
And the native callback will be called every time the size is changed.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Berrysoft
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2607 on April 21, 2023 07:50.