Re: Writing to a buffer

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

 




> Any obvious mistakes in this?

You probably need to use _scroll_to_mark(), see question 4.3:

http://developer.gnome.org/doc/API/2.0/gtk/gtk-question-index.html

Thanks for the pointer; it isn't working yet. The text displays, but it doesn't scroll down. The code that's doing the inserts is:

    GtkTextMark *mark;
    gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(pmsg_buffer), "\n",
      strlen("\n"));
    gtk_text_buffer_insert_at_cursor(GTK_TEXT_BUFFER(pmsg_buffer), message,
      strlen(message));
    mark = gtk_text_buffer_get_insert(GTK_TEXT_BUFFER(pmsg_buffer));
    gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(pmsg_text_view), mark, 0.0, 1,
      0.0f, 1.0f);

I've fiddled around with the gtk_text_view_scroll_to_mark() parameters, and it doesn't scroll down.

Should I be trying to scroll its scrolled window instead? The initializer code is:

    scrolled_window = gtk_scrolled_window_new(NULL, NULL);
    scrolled_window_vertical_adjustment =
      gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrolled_window));
    gtk_container_set_border_width(GTK_CONTAINER(scrolled_window), 0);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
      GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
    gtk_box_pack_start(GTK_BOX(vbox1), scrolled_window, FALSE,
      FALSE, 0);
    gtk_widget_show(scrolled_window);
    pmsg_buffer = gtk_text_buffer_new(NULL);
    pmsg_text_view =
      gtk_text_view_new_with_buffer(GTK_TEXT_BUFFER(pmsg_buffer));
    gtk_widget_show(GTK_WIDGET(pmsg_text_view));
    gtk_widget_show(scrolled_window);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
      GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(
      scrolled_window), pmsg_text_view);


--
++ Jonathan Hayward, jonathan.hayward@xxxxxxxxx
** To see an award-winning website with stories, essays, artwork,
** games, and a four-dimensional maze, why not visit my home page?
** All of this is waiting for you at http://JonathansCorner.com

** If you'd like a Google Mail (gmail.com) account, please tell me!
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux