Treeview internal widgets question


#1

Hi,

I’d like to implement a widget of two Fixeds in a Vbox, attached to a
TreeView in a HBox.
The top Fixed would be attached to the TreeView’s header, in sense, it’d
allocate the same vertical space. Would show some cairo drawings.
The Bottom Fixed would show some cairo drawings. in a ScrolledWindow,
scrolled by the TreeView’s vertical scroller.

My current problem is: i can’t get the TreeView’s columns’ allocated
height, so i could fixate the height of the top Fixed.
Is it possible?
i tried TreeViewColumn.widget.allocation, but the widget it’s nil, since
it’s not set by me.
I’d welcome anything

Thanks
Balint


#2

Dobai-Pataky Bálint wrote:

I’d like to implement a widget of two Fixeds in a Vbox, attached to a
TreeView in a HBox.
The top Fixed would be attached to the TreeView’s header, in sense, it’d
allocate the same vertical space. Would show some cairo drawings.
The Bottom Fixed would show some cairo drawings. in a ScrolledWindow,
scrolled by the TreeView’s vertical scroller.

My current problem is: i can’t get the TreeView’s columns’ allocated
height, so i could fixate the height of the top Fixed.
Is it possible?
i tried TreeViewColumn.widget.allocation, but the widget it’s nil, since
it’s not set by me.
I’d welcome anything

While I haven’t tried what you are doing, here’s a suggestion. Don’t
use Fixeds. Instead create an Image to place in the VBox. I haven’t
looked at cairo yet, but am assuming you can draw on a Pixbuf which you
can get from the Image.

HTH,
Roy


#3

resending with lowres image, to avoid the 40Kb limit

Roy W. wrote:

height, so i could fixate the height of the top Fixed.
Is it possible?
i tried TreeViewColumn.widget.allocation, but the widget it’s nil, since
it’s not set by me.
I’d welcome anything

While I haven’t tried what you are doing, here’s a suggestion. Don’t
use Fixeds.
How would that help me get the TreeView’s header widgets’ height?
Instead create an Image to place in the VBox. I haven’t
looked at cairo yet, but am assuming you can draw on a Pixbuf which you
can get from the Image.

Even on the Image I’d use cairo, i need transparency.

I attached an image, so it’s easier to get want i want to do.
Now the top Fixed is fixed to a 20px height, but that may change with
the theme or if the Column header text is wrapped into rows.

Thanks
Balint


#4

OK, here’s kind of an ugly way that may do what you want.

A TreeView header is actually a Button. Here’s a php-gtk tutorial that
includes how to get the Button.

http://www.kksou.com/php-gtk2/articles/set-the-background-color-of-the-column-header-of-a-treeview.php

I think you can then get the size from Gtk::Widget#size_request, but
haven’t tried it. There is a caveat on size_request must be associated
with a screen.

HTH,
Roy


#5

hi Roy,

this php example sets the column widget, and then uses it, in my
question i noted, that i use the default column widgets, thus
TreeViewColumn.widget returns nil.
my original question was if i can query the header height without using
custom column widgets, but seems this is the only way. i might give that
a try.

thanks for your support
balint