You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might be a dumb question, but based on the examples and documentation I couldn't figure it out, so I am hoping you can help me.
I have a widget which contains a gtk::TreeView. Of course I want something to happen when you select and item in the view, so I created the following code in the view():
let left_selection = left_tree.get_selection();
connect!(relm, left_selection, connect_changed(treesel), {
let (left_model, iter) = treesel.get_selected().unwrap();
let value = left_model.get_value(&iter, 0).get::<String>().unwrap();
println!("connect! Value: {}", value);
Open(value)
});
Which correctly prints out the "connect!" line to the console when clicked, but the Open(value) event is not sent to/received by the update function:
I think you don't save your widget in a variable or a struct. Here is how you do that.
The problem, I think, is that: if you don't save the relm widget somewhere, the communication channel will be closed when the widget is dropped, and the update() method won't be called.
This is one design issue with relm that I want to fix.
So, this is not a dumb question at all: this issue happened to me a few days ago and I really want to provide a way to avoid that.
If this is not the issue, please provide a complete code example.
By the way, in the feature/futures-glib branch, I added support for event on "child" widget, which will allow you to connect the selection changed event of a TreeView with the view! macro. See this example.
You were spot on! Adding the component to the Win struct made the messages work like a charm.
The improvements to the views that you are doing look like a great step forward! When I have my project up and running (just getting the hang of it up to now) I will surely check it out, I will have a more balanced view on the do's and don'ts of the library.
Hi,
This might be a dumb question, but based on the examples and documentation I couldn't figure it out, so I am hoping you can help me.
I have a widget which contains a gtk::TreeView. Of course I want something to happen when you select and item in the view, so I created the following code in the view():
Which correctly prints out the "connect!" line to the console when clicked, but the Open(value) event is not sent to/received by the update function:
Neither the "Update!" not the "Path.." string get printed.
Any ideas as to why the event is triggered, but the message is not sent to the update function?
The text was updated successfully, but these errors were encountered: