Forum: Ruby-Gnome 2 treeview internal widgets question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dobai-Pataky Bálint (Guest)
on 2008-12-01 00:06
(Received via mailing list)
Attachment: dpblnt.vcf (0 Bytes)
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
Roy W. (Guest)
on 2008-12-02 03:26
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
Dobai-Pataky Bálint (Guest)
on 2008-12-02 10:52
(Received via mailing list)
Attachment: plan_low.jpg (0 Bytes)
Attachment: dpblnt.vcf (0 Bytes)
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
Roy W. (Guest)
on 2008-12-03 00:57
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-bac...

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
Dobai-Pataky Bálint (Guest)
on 2008-12-03 12:51
(Received via mailing list)
Attachment: dpblnt.vcf (0 Bytes)
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
This topic is locked and can not be replied to.