Now, I am trying to use the #[widget] attribute with the view! macro to make my life easier.
This means that I have to initialize my gtk::TreeView in my Widget::init_view, macro as neither column nor cellrenderer implement Widget, i.e:
fn init_view(&mut self) {
let col = gtk::TreeViewColumn::new();
col.set_title("Foo");
let cell = gtk::CellRendererText::new();
cell.set_property_editable(true);
col.pack_start(&cell, true);
col.add_attribute(&cell, "text", 2);
self.tree_view.append_column(&col);
}
Problem
Now I try to connect a callback to the event changed of the CellRendererText, with something like:
/* This does not work..! */
connect!(
self.spendings_tree_view,
cell,
connect_edited(_, _, _),
Msg::Changed,
);
However this does not work..! I don't have access to the Relm object, I don't seem to have access to the event stream in general. I thought something such as self.root().emit() could be possible (thence calling connect_edited manually) but nothing I tried actually worked. I also couldn't find anything in the various examples. Is it possible even possible in the current state of the crate?
Context
When implementing the
fn view
functino manually, I have access to therelm::Relm<Self>
parameters that allows me to connect event i.e:as found in https://github.com/antoyo/relm/blob/master/relm-examples/examples/tree-view.rs
Now, I am trying to use the
#[widget]
attribute with theview!
macro to make my life easier. This means that I have to initialize mygtk::TreeView
in myWidget::init_view
, macro as neither column nor cellrenderer implement Widget, i.e:Problem
Now I try to connect a callback to the event
changed
of the CellRendererText, with something like:However this does not work..! I don't have access to the
Relm
object, I don't seem to have access to the event stream in general. I thought something such asself.root().emit()
could be possible (thence callingconnect_edited
manually) but nothing I tried actually worked. I also couldn't find anything in the various examples. Is it possible even possible in the current state of the crate?Thanks!