Re: prevent scrolling in GtkText



Markus Lausser <sgop users sourceforge net> writes:

Hello.

My problem is that the GtkText automatically scrolls down if i insert some
text into it. If i want to scroll up in a my chat window and read the text, 
it automatically scrolls down on every new message. How do i prevent this?

I created the widget with these lines:

  scrolledwindow27 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_ref (scrolledwindow27);
  gtk_widget_show (scrolledwindow27);

  gtk_paned_pack1 (GTK_PANED (channel_widget2), scrolledwindow27, TRUE, TRUE);

  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow27), GTK_POLICY_AUTOMATIC, 
GTK_POLICY_AUTOMATIC);
  gtk_range_set_update_policy (GTK_RANGE (GTK_SCROLLED_WINDOW(scrolledwindow27)->hscrollbar), 
GTK_UPDATE_CONTINUOUS);
  gtk_range_set_update_policy (GTK_RANGE (GTK_SCROLLED_WINDOW(scrolledwindow27)->vscrollbar), 
GTK_UPDATE_CONTINUOUS);

  text4 = gtk_text_new (NULL, NULL);
  gtk_widget_ref (text4);
  gtk_widget_show (text4);
  gtk_text_set_word_wrap(GTK_TEXT(text4), 1);
  gtk_container_add (GTK_CONTAINER (scrolledwindow27), text4);

Anyone could help me?

Independent of your actual problem, when you create widgets, you get a
floating reference to them.  Ie, they start with a reference which is
then assumed when added to another container.  As a result, you probably
don't need the gtk_widget_ref () calls, unless you are doing something
special.

Thanks,
-Jonathan




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