getting scrollbar to stick



Hi,

How does one get the scrollbar (which is the vadjustment for a text
widget) to stay put?

I have a text widget that displays the state of some data. When the data
changes, I update the text widget by deleting all of the text it
contains and then reinserting the new data.

The user can scroll down in the text widget to view specific portions of
the data. The problem is, upon refreshing the data, the scrollbar always
goes back to the top line. What I want is for the scrollbar to just stay
where it is.

So before I do the deletion/insertion bit, I have:

  adj = GTK_ADJUSTMENT (GTK_TEXT (text)->vadj);
  pos = adj->value;

And after the text is inserted and unfrozen, I have:

  gtk_editable_set_position (GTK_EDITABLE (text), pos);
  gtk_text_set_point (GTK_TEXT (text), pos);
  GTK_ADJUSTMENT (GTK_TEXT (text)->vadj)->value = pos;

Obviously this does not work, else I wouldn't be emailing the list. :)
What happens is that the scrollbar *still* goes back to the top line of
the widget.  Any help would be much appreciated.

Thanks.

/Alex

-- 
Alex Chiang       <> verily, the thoughts contained withal be mine own,
since 
Hewlett-Packard   <> and not, as it were, of mine gracious employer 
ph: 972.497.3817

I will not turn into a snake. It never helps.
	-how I will rule my Evil Empire




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