I have a gtk::Dialog with an Ok button. This dialog has a TreeView with editable cells.
If you click “OK” when editing a cell, the new data in cell will be removed. How save new data to cell?
I try in dialog.connect_delete_event add CellTextRender.stop_editing.
my code in cut version:
let dialog = gtk::Dialog::with_buttons(Some("Пользователи"), parent,
gtk::DialogFlags::MODAL, &[("OK", gtk::ResponseType::Ok)]);
let table = gtk::TreeView::new();
let user_model = gtk::ListStore::new(&[glib::Type::STRING]);
table.set_model(Some(&user_model));
table.set_enable_grid_lines(gtk::TreeViewGridLines::Both);
let user_name_render = gtk::CellRendererText::new();
user_name_render.set_editable(true);
let user_name_column = gtk::TreeViewColumn::with_attributes("Username", &user_name_render, &[("text", 0 as i32)]);
user_name_column.set_resizable(true);
table.append_column(&user_name_column);
dialog.content_area().pack_start(&table, true, true, 0);
dialog.show_all();
dialog.run();
And gif animation:
error_gif
1