Re: [gtk-list] Problems with the vadj of a text widget



Jeff Shipman writes:
>I'm using the following code to insert text and try to keep my
>adjustment bar all the way at the bottom, but unfortunately it doesn't
>quite hit the bottom.
>
>   gtk_text_freeze(GTK_TEXT(log));
>   gtk_text_insert(GTK_TEXT(log), NULL, &color, NULL, message, -1);
>   gtk_text_set_point(GTK_TEXT(log),
>gtk_text_get_length(GTK_TEXT(log)));
>   gtk_adjustment_set_value(GTK_TEXT(log)->vadj,
>GTK_TEXT(log)->vadj->upper);
>   gtk_text_thaw(GTK_TEXT(log));

I suspect that what's happening is that the adjustment isn't updated
until the text widget is thawed, so you're really moving vadj to the
_old_ end, not the _new_ end (make sense)?  You should be able to fix
that by swapping the order of the gtk_adjustment_set_value() and the
gtk_text_thaw().

Cheers,
Gary.
-- 
        Gary Wong, Department of Computer Science, University of Arizona
            gary@cs.arizona.edu     http://www.cs.arizona.edu/~gary/



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