Re: Question regarding GTK library



I'm not sure if it is the best solution, but here is what I did (copies of the relevant sections from my sources, including my comments):

    //in order to scroll to the bottom after the text had been added we have to use
    //  the "changed" signal of the GtkAdjustment. This is because this signal will
    //  be emitted after the text is rendered. This has not been documented anywhere,
    //  but it works (gtk 2.6.10-1).
    GtkWidget *scrWnd = glade_xml_get_widget(glade_xml,"scrolledwindow1");
    GtkAdjustment *adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrWnd));
    g_signal_connect(adj, "changed", (GCallback)adjChangedHndl, this);


void wndDown2usb::adjChangedHndl(GtkAdjustment *adjustment, gpointer data)
{
    wndDown2usb *_this = (wndDown2usb*)data;
    g_signal_emit_by_name(_this->tv, "move-viewport", GTK_SCROLL_ENDS, 1, data, NULL);
}



Off course 'tv' is the GtkTextView widget.

Hope it helps,

regards,
lukgrom

2010/3/2 Lena Polipas <lenapolipas yahoo com>

Hello,

I am trying to build send/respond messages user interface as Hyper terminal or Tera  Term using GTK library. I have a Multi-line TextView with vertical scroll bar. I want to scroll the vertical bar automatically down as the last added line should be visible.

Could you help me to find a solution for this problem? Is there any property or method to do it?

Thank you,

Lena.



_______________________________________________
gnome-list mailing list
gnome-list gnome org
http://mail.gnome.org/mailman/listinfo/gnome-list




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