Automatic scrolling with TextView in a Grid

I have a TextView inside a Grid. This Grid is added to a ScrolledWindow. Whenever I go beyond the visibility of TextView by typing a long text with many lines, the ScrolledWindow doesn’t scroll automatically. So I wonder if there is any good way to implement automatic scrolling (to bottom)?

What version of GTK are you using?

I have re-constructed what you describe with GTK3, using Glade, and can’t reproduce what you describe. It does scroll automatically, just fine.

I am uploading the example here so you can run it with Glade as well, and compare it with what you have:

Hope it helps!

1 Like

Gtk3. Let me try it and tell you. Thanks!

No, actually I want automatic scrolling to bottom. Like take the same file you have, as you hit newline, the text goes below the visibility of window and you need to scroll manually to bottom. So I want automatic scrolling. :smiley:

EDIT: forget what I suggested here, the issue is the grid between the scrolled window and the text view, remove it and it will behave as you want, e.g. try this:

- GtkWindow:
    - GtkScrolledWindow
        - GtkTextView

The grid is not scrollable, but the text view is. So as long as you put the text view as a direct child of the scrolled window it will work fine.

Do you really need that grid in between?

Yea, I need the grid, cause I’m having multiple textviews on a page…

In that case, maybe you can elaborate a bit further about what are you trying to achieve, so we could help you more appropriately.

e.g. why not having a scrolled window per text view?


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