How to use TextViews native scrolling ability via Gtk.Scrollable

Hi,

According to docs Gtk.TextView inherits from Gtk.Scrollable

Gtk.Scrollable is described as “widgets with native scrolling ability.” https://lazka.github.io/pgi-docs/#Gtk-3.0/classes/Scrollable.html#Gtk.Scrollable

But I’m having a really hard time finding anything about that. Glade offers some options, but they don’t really do anything, at least I couldn’t figure out anything at all there.

image

No idea how to get this to work. Can’t find examples, tutorials, not even other projects that use this.

I’d like to see how this makes a difference for various things over using Gtk.ScrolledWindow.

I think the point of Gtk.Scrollable is that no Gtk.Viewport is needed anymore.

So the Gtk.TextView is added to Gtk.ScrolledWindow directly via .add

The benefit is that it scrolls down when writing text over many lines.

What is your issue exactly?

The benefit for GtkTextView is that it knows how much text is visible, so can optimize by not drawing the invisible (because scrolled out of view) parts.

I have resolved all of my issues. Thanks

I especially wanted to see if it makes a difference for get_cursor_locations, because I got numbers that are too large when scrolled down, but buffer_to_window_coords was the way to correct that.