[gtkada] Update CTree contents and horizontal scrollbars

Marc A. Criley mcq95 at earthlink.net
Mon Jul 22 15:08:29 CEST 2002


Responding to my own post for the sake of the GtkAda archive and future
searches :-)

Executive summary of problem resolution:  My mistake.

The problem didn't have anything to do with scrollbars, adjustments, or
changing the node text.  What I had been doing was adding the CTree control
to a Viewport, then adding that to the Scrolled_Window.  I happened to spot
a comment in the Scrolled_Window docs that said that you didn't need to use
a Viewport when adding a control that managed its own scrolling, like a
CList, to a Scrolled_Window.  Well, CTree is derived from CList, so I dumped
the Viewport and added the CTree directly into the window.

This fixed the horizontal scrolling problem (although I may also have
specified Set_Column_Auto_Resize--I can't remember and I'm not with my code
right now...) and it also kept the column heading from disappearing when
doing vertical scrolling.

Marc A. Criley

> -----Original Message-----
> From: gtkada-admin at lists.act-europe.fr
> [mailto:gtkada-admin at lists.act-europe.fr]On Behalf Of Marc A. Criley
> Sent: Friday, July 19, 2002 8:25 AM
> To: gtkada at lists.act-europe.fr
> Subject: [gtkada] Update CTree contents and horizontal scrollbars
>
>
> I am using a CTree for data display.  The structure of the tree,
> once built,
> does not change.  By the "structure", I mean the hierarchy--the number of
> branches, which branches have subtrees, and so on--none of that changes
> after the tree has been created.
>
> What does change, though, is the text associated with each branch.  I know
> how to do this and display the updates and that is all working just fine.
>
> What is not working, though, is what happens when the new branch text is
> longer than the previous value, i.e., the text that was present when the
> tree was originally built.  As each tree is displayed in its own little
> "data window" I want to have horizontal adjustment sliders rather than
> forcing the window to have to be resized to view the new values.
>
> I'm displaying the tree in a Gtk.Scrolled_Window, with the
> Scrollbar_Policy
> for both Horizontal and Vertical intended to be set to Policy_Automatic.
> Despite doing this, when the node text ends up wider than the window, no
> horizontal scrollbar appears.  And if I set the policy to Policy_Always,
> there's a horizontal scrollbar, but the occupied portion of the
> scrollbox is
> not recalculated after the text is updated.
>
> I've tried using the Set_Column_Auto_Resize procedure, with no effect, and
> poked around at trying some stuff with Adjustments, but not yet having any
> success.
>
> I would appreciate any suggestions on how to get the scrollbars to work
> properly in this situation.
>
> Thanks,
>
> Marc A. Criley






More information about the gtkada mailing list