Re: Setting the scroll position of a GtkTextView in GtkScrolledWindow after render





On 04/08/2019 09:07 AM, Andri Möll via gtk-app-devel-list wrote:
Hey,

I can't figure out if it's me or something's amiss. I'm trying to set the scroll position after rendering a GtkTextView in a GtkScrolledWindow, but it's reset to a different value, if it works at all. I've so far tried to set the vertical adjustment value both after GtkScrolledWindow is mapped or its child (GtkTextView) size-allocated. When using a GtkListBox instead of a GtkTextView and setting the adjustment's value on "size-allocate", it works. No such luck with a GtkTextView, however.

The peculiar thing with the GtkTextView is, while the adjustment reports its upper bound to be, for example, 588 and its value 0, immediately after setting it to 493, it reports its value as 11. I figure "size-allocate" is still the wrong event to use here given the adjustment is in flux. What would the right path be to consistently set the scroll position after the first render, and later, after resetting the GtkTextView's buffer?

You probably are affected by the same problem as https://stackoverflow.com/questions/48934458/gtk-sourceview-scroll-to-mark-not-working.

Basically, you need to add a timeout (glib_idle_add or so) to allow all render calculations to be done.

Reuben


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]