After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 129318 - Add "visible_rows" property to GtkTreeView.
Add "visible_rows" property to GtkTreeView.
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
unspecified
Other Linux
: Normal enhancement
: Medium API
Assigned To: gtktreeview-bugs
gtktreeview-bugs
: 654236 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2003-12-14 16:10 UTC by Jan Arne Petersen
Modified: 2018-02-10 03:24 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
This patch implements the visible_rows property. (6.71 KB, patch)
2003-12-14 16:22 UTC, Jan Arne Petersen
needs-work Details | Review

Description Jan Arne Petersen 2003-12-14 16:10:48 UTC
If you embed a GtkTreeView into a GtkScrolledWindow the requested height of
the scrolled window is only computed by the requested sizes of the scrollbars.

It should be possible to define the count of visible rows.

There should be a "visible_rows" property (the number of visible rows in a
tree view which is embedded in a scrolled window) for the GtkTreeView
widget to solve this problem.
Comment 1 Jan Arne Petersen 2003-12-14 16:22:32 UTC
Created attachment 22437 [details] [review]
This patch implements the visible_rows property.
Comment 2 Jan Arne Petersen 2003-12-19 22:01:35 UTC
kris and jrb don't like a visible rows solution. I agree that there
are problems to find a solution, which doesn't fail at small/large
displays and at small/large fonts.

So i started to look at other UI toolkits:

- Fox: numVisible
- Java (AWT): Use native toolkit
- Java (Swing): visibleRowCount
- OSX: ?
- Motif: visibleItemCount
- Qt: 10 rows visible and between 40 and 200 pixels
- tk: height (= visible rows)
- Windows: ?

As you can see they don't have other (working) solutions. It would be
really nice if someone have an idea how to solve this problem (or can
look at the solutions of OSX, windows or any other UI toolkit).
Comment 3 Federico Mena Quintero 2004-02-14 01:26:10 UTC
I'm going to put this in the 'future' milestone.  We should have a
minimum size requisition and a preferred size requisition.
Comment 4 Johan (not receiving bugmail) Dahlin 2006-12-05 17:20:27 UTC
I implemented a similar functionality for kiwi;

     def set_visible_rows(self, rows):
        treeview = self._treeview

        if treeview.get_headers_visible():
            treeview_column = treeview.get_column(0)
            button = self._get_column_button(treeview_column)
            treeview.realize()
            alloc = button.get_allocation()
            header_h = alloc.height
        else:
            header_h = 0

        column = treeview.get_columns()[0]
        h = column.cell_get_size()[-1]

        focus_padding = treeview.style_get_property('focus-line-width') * 2
        treeview.set_size_request(-1, header_h + (rows * (h + focus_padding)))

Which seems to do the right thing (as in pixel perfect height), I have only tested it with the default ubuntu theme though, so it might be some variations with other themes.
Comment 5 Kristian Rietveld 2011-07-11 13:05:44 UTC
*** Bug 654236 has been marked as a duplicate of this bug. ***
Comment 6 Matthias Clasen 2018-02-10 03:24:13 UTC
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and
still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue
for it.