Closed MGlolenstine closed 3 years ago
I've solved the problem. You can use relm::create_component
, provide arguments for the model
method and just call widget()
on it to get the widget you're looking for.
let item_card = relm::create_component::<ItemCard>(d);
let item_card = item_card.widget();
self.widgets.search_result_box.add(item_card);
You can also import the trait ContainerWidget
and call the method add_widget()
.
How does one create a new instance of a Relm widget? If I want to add GTK widgets to a
FlowBox
, we'd do it from inside theinit_view
and just usegtk::Container::add()
, but I'm unsure on how to do it with Relm widgets, as they don't seem to havenew()
method and the only method that returns the widget itself isview
, which requiresRelm<WidgetModel>
.Is there a better way to do this, maybe just linking a vector to the
FlowBox
?