Editing Cells in Gtk::ListStore

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

Maybe you need this:
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. [email protected] ]------------------+
| |
| Mobile:(+36 20)356 9656 |
| |
± “Olyan lángész vagyok, hogy poroltóval kellene járnom!” -+


This 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/

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. [email protected] ]------------------+
| |
| Mobile:(+36 20)356 9656 |
| |
± “Olyan lángész vagyok, hogy poroltóval kellene járnom!” -+


This 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/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs