# Ruby gtk editable cells in treeview

**URL:** <https://www.ruby-forum.com/t/ruby-gtk-editable-cells-in-treeview/77668>\
**Category:** Ruby\
**Created:** [November 29, 2006, 4:39pm UTC](https://www.ruby-forum.com/t/ruby-gtk-editable-cells-in-treeview/77668 "2006-11-29T16:39:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alfonso](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/bbe5ce/32.png) [@Alfonso](https://www.ruby-forum.com/u/Alfonso)\
**Post date:** [November 29, 2006, 4:39pm UTC](https://www.ruby-forum.com/t/ruby-gtk-editable-cells-in-treeview/77668/1 "2006-11-29T16:39:39Z")

</div>

Could anyone put an example of how can you make editable the cells of a  
ListStore or ThreeStore in in ruby gtk, and making them update when  
edited? I’m trying to guess how to do that looking at the api, but can  
get the right procedure, and the tutorial for treeviews doesn’t cover  
this topic.

Thank you very much for your help.

* * *

LLama Gratis a cualquier PC del Mundo.  
Llamadas a fijos y móviles desde 1 céntimo por minuto.  
[http://es.voice.yahoo.com](http://es.voice.yahoo.com)

---

<div class="post-metadata">

**Author:** ![Alfonso](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/bbe5ce/32.png) [@Alfonso](https://www.ruby-forum.com/u/Alfonso)\
**Post date:** [November 30, 2006, 12:37am UTC](https://www.ruby-forum.com/t/ruby-gtk-editable-cells-in-treeview/77668/2 "2006-11-30T00:37:55Z")

</div>

Olivier  
escribió:\>

> tog\_renderer.signal\_connect(‘toggled’) do |renderer, path|
> 
> Olivier

That was what I needed, thank you very much

* * *

LLama Gratis a cualquier PC del Mundo.  
Llamadas a fijos y móviles desde 1 céntimo por minuto.  
[http://es.voice.yahoo.com](http://es.voice.yahoo.com)

---

<div class="post-metadata">

**Author:** ![Alfonso](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/bbe5ce/32.png) [@Alfonso](https://www.ruby-forum.com/u/Alfonso)\
**Post date:** [November 29, 2006, 5:27pm UTC](https://www.ruby-forum.com/t/ruby-gtk-editable-cells-in-treeview/77668/3 "2006-11-29T17:27:48Z")

</div>

Le mercredi 29 novembre 2006 16:37, Alfonso a écrit :

> Could anyone put an example of how can you make editable the cells of a  
> ListStore or ThreeStore in in ruby gtk, and making them update when  
> edited? I’m trying to guess how to do that looking at the api, but can  
> get the right procedure, and the tutorial for treeviews doesn’t cover  
> this topic.
> 
> Thank you very much for your help.

just a quick copy/paste from a personal project :

var\_renderer = Gtk::CellRendererText.new  
var\_renderer.editable = true  
var\_renderer.signal\_connect(‘edited’) do |renderer, val, var|  
# use Treeview#selection#selected to modify the  
# model. var contains the new text.  
end  
tog\_renderer = Gtk::CellRendererToggle.new  
tog\_renderer.activatable = true  
tog\_renderer.signal\_connect(‘toggled’) do |renderer, path|  
# do whatever you want  
end

Any action from the user is handled by signals. The doc does not  
describe well  
what action triggers a signal (even the original C api is poor about  
that),  
so the best thing to do is to seek for the “signal” section of the class  
api  
(here, the CellRendererText), then try to connect to the signal which  
seems  
to fit your needs, and to test :

1. what action triggers the signal
2. what block arguments can be used ( Kernel#p is usefull here ;))

Olivier
