logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: Freeze a treeview column: msg#00131

Subject: Re: Freeze a treeview column
On Fri, Apr 16, 2004 at 10:22:17 -0400, muppet wrote:
> 
> Jan Hudec said:
> > On Thu, Apr 15, 2004 at 12:46:05 -0400, muppet wrote:
> >>
> >> B McAndrews said:
> >> > I'd like to "freeze" a tree view column (the first one) so that
> >> > horizontal scrolling will always show this column.  Is this posible? Or
> >> > can I have some sort of split view?
> >>
> >> ahem: The GtkTreeView is neither a sheet widget nor microsoft excel.
> >>
> >> But what you *can* do is use a paned widget, with a single-column view in
> >> the
> >> left pane and a multi-column view in the right pane.  Both views can look 
> >> at
> >> the same model, and you can make them both use the same scrollbar
> >> adjustments
> >> so they will scroll together.  The trouble is that i don't know if it's
> >> possible to hide the scrollbar on the left pane without implementing your
> >> own
> >> container.
> >
> > IIRC it's packed like:
> >
> >     +ScrolledWindow----+
> >     |+Viewport------+ ^|
> >     ||+the widget--+| v|
> >     |||            || S|
> >     |||            || c|
> >     |||            || r|
> >     |||            || o|
> >     |||            || l|
> >     ||+------------+| l|
> >     |+--------------+ V|
> >     |<HScrollBar---->  |
> >     +------------------+
> >
> > And the scrolledwindow is just a 2x2 table, that shows/hides the
> > scrollbars acoording to difference between it's allocation and child's
> > requisition. It is possible to pack a viewport and scrollbars in
> > a normal table, except the scrollbars must always be visible.
> >
> > Note: I am not actualy sure if ScrolledWindow uses Viewport internaly,
> > but I am sure a Viewport exists.
> 
> $scrolled_window->add_with_viewport ($child) won't buy you anything, because
> a) the bottom scrollbar in the paned widget will not always be in view and b)
> the TreeView is a natively scrolling widget, and using a viewport on it takes
> a rather substantial performance hit, if i recall correctly.

I am talking about NOT using scrolled_window.

> So, to do that with the proper scrollbars, you'll have to create your own
> container widget with your own scrollbars and viewports, and use the
> adjustments properly.  Getting that to work is something i don't know how to
> do in five minutes, so forgive me if i don't include an example.

I think you don't have to write anything. Just pack it like this:

  +Table------------------------+
  |+Viewport 1--++Viewport 2--+^|
  ||+column 1--+||+the rest--+|V|
  |||          ||||          ||S|
  |||          ||||          ||c|
  |||          ||||          ||r|
  |||          ||||          ||o|
  |||          ||||          ||l|
  ||+----------+||+----------+|l|
  |+------------++------------+V|
  |              <HScrollBar==> |
  +-----------------------------+

And then bind the Adjustments to the viewports manualy.

This should work like ScrolledWindow with both policies set to always,
because all the scrolling functionality is in the viewport widget.

-------------------------------------------------------------------------------
                                                 Jan 'Bulb' Hudec <bulb@xxxxxx>

Attachment: signature.asc
Description: Digital signature

<Prev in Thread] Current Thread [Next in Thread>