Configure event for a text view?



Hi,

My GTK window contains (among others) the following hierarchy of objects:
gtk_window < hpaned < vbox < frame < scrolled_window < text_view < text_buffer

I also set up stuff that scroll to the end whenever text is added to the buffer (note: the buffer is not editable, it's the "standard output" of my app):
  gtk_text_buffer_get_end_iter(text_buf,&end_iter);
  end_ptr=gtk_text_buffer_create_mark(text_buf, NULL, &end_iter, FALSE);
and:
  void output(const char * str){
    gtk_text_buffer_insert(text_buf, &end_iter, str, -1);
    gtk_text_buffer_insert(text_buf, &end_iter, "\n", -1);
    gtk_text_view_scroll_to_mark
      (GTK_TEXT_VIEW(text_view), end_ptr, 0., FALSE, 1., 1.);
  }

Now, I want to scroll down to the end of the text whenever the window is resized. As for now, when the window is shrinked, the end of text gets out of view and the user has to scroll down manually. I thought I'd connect the following:
  void scroll(){
    gtk_text_view_scroll_to_mark
      (GTK_TEXT_VIEW(text_view), end_ptr, 0., FALSE, 1., 1.);
  }
to some "configure-event", but I can't find a widget on which this has the desired effect.

Any help appreciated. Thanks.

--
Lucas Levrel



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