Hi, Le 10/06/2013 12:26, Thomas A. Moulton a écrit : > On 06/09/2013 05:21 PM, Thomas A. Moulton wrote: >> Ok here is a single file example of my code... it works the same way >> it does in my larger project >> >> Any suggestions would be GREATLY appreciated! >> >> tom >> > What happens is when you enter enough lines of text to fill the window > the scrolled window does not scroll up > when the "eob" mark is not visible (eob=last line of text buffer)
The problem you have is that you insert the TextView in the ScrolledWindow through a Viewport. This results in a widget hierarchy like this: ... + GtkScrolledWindow + GtkViewport + GtkTextView This means that the TextView doesn't get to control the ScrolledWinodw, its the Viewport that does. So when you ask scroll_to_mark() the ScrolledWindow won't get the request, and so won't scroll. What you need it NOT to add a Viewport, so you get a hierarchy like this: ... + GtkScrolledWindow + GtkTextView Like this, the thing that gets scrolled is the TextView, not a kind of proxy. GtkViewport is only useful if you want to add a non-scrollable widget (e.g. boxes, grids, etc) to a scrolled window: it acts as a proxy that implements the scrolling. On the other hand, if the widget you want to add IS scrollable (implement the GtkScrollable interface), it must NOT be in a Viewport: if it does, it will expect scrolling requests and alike, but never get them since its the Viewport that gets them. In practice, just replace gtk_scrolled_window_add_with_viewport(scroll, GTK_WIDGET(text)); with gtk_container_add(GTK_CONTAINER(scroll), GTK_WIDGET(text)); and it will work as you expect. Not that gtk_scrolled_window_add_with_viewport() is even deprecated nowadays, simply adding a child to a ScrolledWindow is enough (it will automatically add a Viewport for you if required -- which is NOT the case for GtkTextViews). Regards, Colomban PS: you do: char line[512]; const gchar *cmd; cmd = gtk_entry_get_text(entry); strcpy(line, cmd); gtk_entry_set_text(entry, ""); ... gtk_text_buffer_insert_with_tags(buf, ..., line, -1, ...); Why do you copy the line in a static buffer (that might be too small, and cause a crash since strcpy() doesn't have a max size parameter)? You could just put the line into the buffer: const gchar *line; line = gtk_entry_get_text(entry); ... gtk_text_buffer_insert_with_tags(buf, ..., line, -1, ...); gtk_entry_set_text(entry, ""); _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list