Stuck on scrolling GtkViewPort to end.

Posted by PP on Stack Overflow See other posts from Stack Overflow or by PP
Published on 2010-04-21T13:59:08Z Indexed on 2010/04/21 14:03 UTC
Read the original article Hit count: 178

Filed under:
|

I am adding one GtkVBox to GtkViewPort.
And I am doing scrolling for GtkViewPort based on two Up/Down Buttons.

I need to display last item in VBox as we do in Message Chat Screens (Message Chat list displays/adds newest chat message at bottom of the list) i doing exact thing.

so for scrolling at the bottom of the GtkViewPort i am doing in the map event call back.

GtkAdjustment* adjustment;
adjustment = gtk_viewport_get_vadjustment(GTK_VIEWPORT(viewport_list));
gtk_adjustment_set_value(adjustment, gtk_adjustment_get_upper(adjustment));

So this works perfectly fine. it displays newest added widget in Vbox at the end.

on some external events I add new Widgets to my VBox and call above code again to display these newly added widgets. on first add it does not scroll at all but on 2nd add to VBOX it scroll upto 2nd last Widget in the list.

Why this might be happening.
It there another way of scrolling GtkViewPort to the end?

Thanks for reading :)

© Stack Overflow or respective owner

Related posts about gtk

Related posts about gtk+