GTK4 `GtkTreeView` not scrolling all the way to selected cells

,

Hello,

I’m trying to put together a GTK4 application using a GtkTreeView in a GtkScrolledWindow (I’m pretty sure I’m doing this correctly - there is no GtkViewport involved, it’s directly using GtkTreeView's GtkScrollable interface). I’m trying to make searching work even for hidden rows, and expand to those rows and select them. I’ve got code to do this, which seems to work, but I’m running into an issue with gtk_tree_view_scroll_to_cell.

When I call gtk_tree_view_scroll_to_cell on a path, it does scroll towards the cell, but it’s not brought into view. To be clear - if the cell is offscreen, it is brought closer, but is often not visible. It seems to scroll a bit towards the cell but not actually snap it into view as it should.
(When I say “should” I am basing this off both the docs and the behaviour in GTK3).

This also happens with navigation with the arrow keys, where navigating down off the bottom of the screen results in the selected row being invisible. Pressing the down arrow does shift the view down, but not enough to bring the now-selected row into view.

This strange behaviour is present in the gtk4-demo under Tree View > Tree Store, but the same demo in the gtk-demo from GTK3 does not do this, and nor does the GTK4 interactive debugger, which also appears to use a GtkTreeView.

I’m wondering if I’ve done something wrong that could be causing this - if so I’d like to fix it or find a way to properly bring a cell into view in the GtkScrolledWindow - but since it’s present in the demo I’m not actually sure if it’s my mistake or a bug (although other people don’t seem to be reporting it).

I’m using GTK 4.7.0 built from source on Manjaro Linux.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.