Replies: 1 comment
-
Hello, The way I found (I don’t understand how to use widget templates…): #[relm4::component]
impl SimpleComponent for Bar {
type Init = ();
type Input = ();
type Output = ();
view! {
gtk::Box {
append: model.foo.widget(),
}
}
fn init(
counter: Self::Init,
root: Self::Root,
sender: ComponentSender<Self>,
) -> ComponentParts<Self> {
let foo = Foo::builder()
.launch(())
.detach();
let model = AppModel { foo };
let widgets = view_output!();
ComponentParts { model, widgets }
}
} It would be nice to have a syntax similar to relm3 to do this directly in the view! {
gtk::Box {
Foo(/* init */) {
/* Messages forwarding */
}
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
Imagine I have a component
Foo
and a componentBar
.Is it possible to place / add / reference
Foo
inside the componentBar
? Is it possible to place it in theview!
macro ?If yes how to ? And why isn't it mentioned in the book (from what I've read) ?
Or are the
template
the only way to do this ?Thank you very much in advance for any help
Beta Was this translation helpful? Give feedback.
All reactions