ruby gtk editable cells in treeview

A

Alfonso

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
 
O

Olivier

Le mercredi 29 novembre 2006 16:37, Alfonso a =E9crit=A0:
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 =3D Gtk::CellRendererText.new
var_renderer.editable =3D 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 =3D Gtk::CellRendererToggle.new
tog_renderer.activatable =3D 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 w=
ell=20
what action triggers a signal (even the original C api is poor about that),=
=20
so the best thing to do is to seek for the "signal" section of the class ap=
i=20
(here, the CellRendererText), then try to connect to the signal which seems=
=20
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
 
A

Alfonso

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


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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Big project in ruby 3
encoding in windows (newby question) 4
encoding question 1
ruby indentantion 20
getting volume names in windows 4
Saving an UTF-8 file 5
Ampersand entities 3
Class & modifiers modifiers 4

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top