gtkscrollbargladegtktreeview

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?


Solution

  • 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>