qarmin
(Rafał Mikrut)
July 8, 2021, 6:39pm
1
Hi,
I need to read value of thing passed to TreeViewColumn
e.g. in this code
fn add_columns(model: &Rc<gtk::ListStore>, treeview: >k::TreeView) {
// Column for fixed toggles
{
let renderer = gtk::CellRendererToggle::new();
let model_clone = model.clone();
renderer.connect_toggled(move |w, path| fixed_toggled(&model_clone, w, path));
let column = gtk::TreeViewColumn::new();
column.pack_start(&renderer, true);
column.set_title("Fixed?");
column.add_attribute(&renderer, "active", Columns::Fixed as i32);
column.set_sizing(gtk::TreeViewColumnSizing::Fixed);
column.set_fixed_width(50);
treeview.append_column(&column);
}
parameter active is set depending on user input(false/true) set here:
Data {
fixed: false,
number: 60482,
severity: "Normal".to_string(),
description: "scrollable notebooks and hidden tabs".to_string(),
},
How can I read check which value user used inside a add_columns function?
Is there exists something like
println!("{}", column.get_attribute(&renderer, "active", Columns::Fixed);
That will print true/false?
matthiasc
(Matthias Clasen)
July 10, 2021, 12:47pm
2
gtk_tree_view_column_add_attribute() sets up a mapping between a column in your model (Fixed, in this case), and a property of the cell renderer (“active”). There is one value of Fixed for each row in your model, and you can get it from the model with gtk_tree_model_get().
system
(system)
Closed
July 24, 2021, 12:48pm
3
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.