Forum: Ruby-Gnome 2 how to change the rendering in a cell of a treeview in gtk2

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
87c4001f43f7659be0e6b3197ad20296?d=identicon&s=25 Peng H. (peng_h)
on 2013-01-24 12:19
Hi, I am just starting to use gtk2 library. I have a problem which I
think should be a simple one but I cannot find an answer with google or
checking the doc. What I want is change the rendering (like making it
insensitive) of certain cells or rows in an established treeview with a
check button. The button sits beside the treeview.

what I tried is adding some extra lines into the
"col.set_cell_data_func(renderer)" function which run at the treeview
initialization. I want to make certain cells insensitive. What I got is
that certain cells will only become insensitive when the cursor was
moved onto the cell. This is not what I want. The effect I want is
certain rows or cells become insensitive immediately when I click on the
check button.

I guess I am doing it the wrong way. Any suggestions?

Thanks in advance.
0d130f179f85401f248e6ebc2ef8292f?d=identicon&s=25 Eric C. (eric_c)
on 2013-01-27 08:14

If I understand your question, you have a single checkbox (not a column
in the treeview) that when you check it you want the treeview to repaint
so that certain cells are insensitive?

The way to do this is you write a handler for the checkboxes "toggled"
method that repaints the treeview:

In visualruby:

def checkbox__toggled(*args)
  # make cells insensitive here
  @builder["scrolledwindow1"].hide  # repaint treeview

If you're using gtk directly:

checkbox.signal_connect("toggled") { |x,y| checkbox__toggled(x,y) }

(something like that?!?!?)

Hope it helps,
87c4001f43f7659be0e6b3197ad20296?d=identicon&s=25 Peng H. (peng_h)
on 2013-02-02 15:37
Hi Eric,

thanks a lot for your explanation.

I am using gtk2. And I has been using the


method as you explained. But I do not know how to repaint the tree view.
To be specific, I already have this @treeview object. How do I render
again certain rows? Is it possible to get the handle of renderers of
certain rows or columns from the @treeview object so that I can set
renderer.sensitive to false?

Or should I create a new renderer and couple it with the @treeview?

This topic is locked and can not be replied to.