Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating columns with editable cells in Gtk treeview using Glade

Tags:

gtk

glade

I am trying to create a simple GUI with table containing x and y coordinates of samples. I use treeview, and I want the cells of the table to be editable by user. Is it possible to specify if the cells should be editable directly in Glade in cellrenderer properties, or do I have to specify it in my code? I use Glade 3.6.1

I have just found out that unticking box "Editable" in the Tree View Editor when editing my treeview, enables me to specify whether the cells shall be editable or not, because if the box is unticked, the cells editable property is no longer connected with the model. But if I run the program, cells are editable, but the value that I write inside disappears. How can I fix that? Why doesn't the cell store the value I type inside?

Thanks for any hint

like image 834
Tomas Novotny Avatar asked Jun 29 '10 17:06

Tomas Novotny


1 Answers

For anyone dealing with a similar problem, I have solved it - whenever a cell is edited, appropriate record in the model needs to be changed, example code in Python:

cell.connect("edited", self.text_edited, model, column)

def text_edited( self, w, row, new_text, model, column)
  model[row][column] = new_text
like image 125
Tomas Novotny Avatar answered Nov 08 '22 22:11

Tomas Novotny