Re: GtkTextView and scrolled window



Ð ÐÑÑ, 12/04/2005 Ð 10:15 -0700, Paolo Costabel ÐÐÑÐÑ:
Mishael A Sibiryakov wrote:

Hello.

    I have a two small question about GtkTextView and about how it works
with scrolled window widget.

    1. I have a TextView witch is placed to scrolled window (this is simple
chat window), and i want to do automatic scroll is new message inserted
to TextBuffer. How can i do that ? I try to read about GtkAdjustment but
i have not absolutely understood how i can do that.

 

When you enter text in a TextView, it will automatically scroll. Look at 
the gtk-demo for an example.

        It is not editable buffer. This is a chat messages buffer, something
like irc and etc. And it does not want scroll, differently i would not
write :)

        Look at the code.

    scroll = gtk_scrolled_window_new(NULL, NULL);
    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
                                   GTK_POLICY_AUTOMATIC,
                                   GTK_POLICY_AUTOMATIC);

    hub->gui.messb = (GtkWidget *)gtk_text_buffer_new(NULL);
    gtk_text_buffer_get_start_iter(GTK_TEXT_BUFFER(hub->gui.messb),
&hub->gui.iter);
    text =
gtk_text_view_new_with_buffer(GTK_TEXT_BUFFER(hub->gui.messb));
    gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
    gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(text), FALSE);
    gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);

    gtk_container_add(GTK_CONTAINER(scroll), text);





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