# Editing Cells in Gtk::ListStore

**URL:** <https://www.ruby-forum.com/t/editing-cells-in-gtk-liststore/90739>\
**Category:** Ruby-Gnome 2\
**Created:** [March 31, 2007, 6:13pm UTC](https://www.ruby-forum.com/t/editing-cells-in-gtk-liststore/90739 "2007-03-31T18:13:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![justin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3ab097/32.png) [@justin](https://www.ruby-forum.com/u/justin)\
**Post date:** [March 31, 2007, 6:13pm UTC](https://www.ruby-forum.com/t/editing-cells-in-gtk-liststore/90739/1 "2007-03-31T18:13:15Z")

</div>

I have compiled code that generates a two column list store with gtk2. I  
have enabled one column to be editable but I cannot figure out how to  
store the data that I type into the cell. Every time I enter a number  
into the cell and press enter it goes back to zero.

Here is a sample of the code:

```
@nodeListStore = Gtk::ListStore.new(String)
@destListStore = Gtk::ListStore.new(String,Integer)

@costRender = Gtk::CellRendererText.new.set_editable(true)

@nodeCol = Gtk::TreeViewColumn.new("Node Name",

```

Gtk::CellRendererText.new, :text=\>0)  
@destCol = Gtk::TreeViewColumn.new(“Destinations”,  
Gtk::CellRendererText.new, :text=\>0)  
@costCol = Gtk::TreeViewColumn.new(“Cost”,@costRender,:text=\>1)

```
@nodeTreeView = Gtk::TreeView.new(@nodeListStore)
@nodeTreeView.append_column(@nodeCol)
@nodeTreeView.selection.set_mode(Gtk::SELECTION_SINGLE)

@destTreeView = Gtk::TreeView.new(@destListStore)
@destTreeView.append_column(@destCol)
@destTreeView.append_column(@costCol)
@destTreeView.selection.set_mode(Gtk::SELECTION_SINGLE)

```

Any Suggestions

---

<div class="post-metadata">

**Author:** ![justin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3ab097/32.png) [@justin](https://www.ruby-forum.com/u/justin)\
**Post date:** [May 4, 2007, 6:25pm UTC](https://www.ruby-forum.com/t/editing-cells-in-gtk-liststore/90739/2 "2007-05-04T18:25:00Z")

</div>

Maybe you need this:  
[http://ruby-gnome2.sourceforge.jp/hiki.cgi?cmd=view&p=Gtk%3A%3ACellEditable&key=editable](http://ruby-gnome2.sourceforge.jp/hiki.cgi?cmd=view&p=Gtk%3A%3ACellEditable&key=editable)

Anyway, you can find plenty of samples in the distro…

–  
±[Gergely K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) ]------------------+  
| |  
| Mobile:(+36 20)356 9656 |  
| |  
± “Olyan lángész vagyok, hogy poroltóval kellene járnom!” -+

* * *

This [SF.net](http://SF.net) email is sponsored by DB2 Express  
Download DB2 Express C - the FREE version of DB2 express and take  
control of your XML. No limits. Just data. Click to get it now.  
[http://sourceforge.net/powerbar/db2/](http://sourceforge.net/powerbar/db2/)

---

<div class="post-metadata">

**Author:** ![justin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/3ab097/32.png) [@justin](https://www.ruby-forum.com/u/justin)\
**Post date:** [May 4, 2007, 6:38pm UTC](https://www.ruby-forum.com/t/editing-cells-in-gtk-liststore/90739/3 "2007-05-04T18:38:00Z")

</div>

You must write the data to the model in Gtk::CellRendererText’s edited  
signal

See  
samples\ruby-gnome2\gtk\gtk-demo\editable\_cells.rb

–  
±[Gergely K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) ]------------------+  
| |  
| Mobile:(+36 20)356 9656 |  
| |  
± “Olyan lángész vagyok, hogy poroltóval kellene járnom!” -+

* * *

This [SF.net](http://SF.net) email is sponsored by DB2 Express  
Download DB2 Express C - the FREE version of DB2 express and take  
control of your XML. No limits. Just data. Click to get it now.  
[http://sourceforge.net/powerbar/db2/](http://sourceforge.net/powerbar/db2/)
