Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make a GtkTreeView work with a vertical scrollbar in Glade3?

I'm using glade 3, to create TreeView and successfully added row as algorithm done, but I had a little issue because treeview will add new row, thus my "GUI" will getting longer to the below, how could I add the scrollbar for this TreeView? in order to make my "GUI" not getting any longer?

Note: I have added "a new adjustment" and connected it for TreeView and ScrollBar vertical as well, but still not get the job done.

any idea?

like image 762
capede Avatar asked Feb 18 '11 16:02

capede


People also ask

How do I set my vertical scrollbar?

For vertical scrollable bar use the x and y axis. Set the overflow-x:hidden; and overflow-y:auto; that will automatically hide the horizontal scroll bar and present only vertical scrollbar. Here the scroll div will be vertically scrollable.

How do I add a vertical and horizontal scrollbar in HTML?

To do this you will first need to set a fixed height (for vertical scrolling) or fixed width (for horizontal scrolling) on the container. Then you can use overflow-x and overflow-y to tell the browser how to handle content that extends outside of that width/height.

How do I add a scrollbar to an element?

You need to add style="overflow-y:scroll;" to the div tag. (This will force a scrollbar on the vertical).


1 Answers

Try putting your TreeView into a GtkScrolledWindow. E.g.:

<child>
  <object class="GtkScrolledWindow" id="scrolledwindow1">
    <property name="visible">True</property>
    <property name="hscrollbar_policy">automatic</property>
    <property name="vscrollbar_policy">automatic</property>
    <child>
      <object class="GtkTreeView" id="items_view">
        <property name="visible">True</property>
        <property name="can_focus">True</property>
        <property name="model">list_items</property>
      </object>
    </child>
  </object>
</child>
like image 141
serge_gubenko Avatar answered Sep 20 '22 11:09

serge_gubenko