Re: Freeze rows and columns of GtkGrid
- Date: Fri, 27 Apr 2018 10:00:47 -0400 (EDT)
- From: Stu Whitman <swhitman@xxxxxxxxxx>
- Subject: Re: Freeze rows and columns of GtkGrid
----- On Apr 19, 2018, at 4:10 PM, Stu Whitman <swhitman@xxxxxxxxxx> wrote:
----- On Apr 17, 2018, at 7:31 PM, Stu Whitman <swhitman@xxxxxxxxxx> wrote:Hello,Is there a way to freeze the first row and column of a GtkGrid when it is scrolled using a GtkScrolledWindow? In some cases it would be nice to freeze the first and last row and/or column.Thanks,-StuI found the gtk_scrollable_get_border() function:Returns the size of a non-scrolling border around the outside of the scrollable. An example for this would be treeview headers. GTK+ can use this information to display overlayed graphics, like the overshoot indication, at the right position.This sounds like what I would like to achieve. Anyone know how to set this border?-Stu
For those that are interested, I found a way to do this. I finally found an old post that talked about GtkSizeGroup. So instead of one GtkGrid I now have 4. Here is what I did:
The first GtkGrid is 2by2. Cell 0,0 is empty. Cell 0,1 contains a single column GtkGrid to store the row labels. Cell 1.0 contains a single row GtkGrid for the column labels. And cell 1,1 contains an n by n GtkGrid. Whenever I add a row or column I also add a GtkSizeGroup to keep the labels sized correctly.
It works well enough, but there are some drawbacks. 1) The user can not resize the columns. 2) You have to get the expand and fill attributes right so the widgets end up the same size. 3) The n by n GtkGrid must always have one column. For my application I had a fixed number of rows. If I remove the last column the row label sizes get out of sync and do not always get the correct size when the column is put back. I ended up setting the sensitivity of the last column to false, instead of hiding it. 4) There is a lot of complexity to manage. It would be nice it the GtkViewPort or GtkScrolledWindow had a way to set a non-scrolling margin.
_______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx https://mail.gnome.org/mailman/listinfo/gtk-list
- Prev by Date: Re: Beginners guide
- Next by Date: How to get Giomm::DBus::Connection file descriptor?
- Previous by thread: Re: Freeze rows and columns of GtkGrid
- Next by thread: gtk-toolbar-style setting in Ubuntu 18.04 (Bionic) no longer working