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.
on 2013-01-24 12:19
on 2013-01-27 08:14
Hi:
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
@builder["window1"].show_all
end
If you're using gtk directly:
checkbox.signal_connect("toggled") { |x,y| checkbox__toggled(x,y) }
(something like that?!?!?)
Hope it helps,
Eric
visualruby.net
on 2013-02-02 15:37
Hi Eric,
thanks a lot for your explanation.
I am using gtk2. And I has been using the
checkbox.signal_connect("toggled"){}
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?
Peng
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.