Nice scroll behavior for GtkText



Hi all,

I've got a display that receives UDP packets of text and displays them
in a GtkText widget.

It seems to work so far.

The problem is that if the operator has the scrollbar moved such that a
given piece of text is visible, it immediately moves to the bottom
whenever additional text is inserted.

Even if the operator holds the scroll thing in place, it pans down all
the way on insert, then scrolls back up.

I know that the vadj and hadj of a GtkText are there for just this
purpose, but I'm not clear how to use them.  Does anyone have any
example code that uses those to get nice scroll behavior?

My ideal behavior would be:
1) If window is scrolled all the way down, window stays all the way
down.
2) If window is not, text in window stays in visible window, which
changes relative position.

and, nice but probably hard:
3) If visible window reaches top of buffer, visible text is not
discarded, but kept visible, and other text is somehow discarded, until
the operator moves scrollwindow.

TIA,

Eric M. Monsler




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