scrolled_window fails to show horizontal scrollbar?



I tried to use the new 1.1 feature that GtkText objects automatically
become scrollable when placed in a GtkScrolledWindow container -- and, 
indeed, for vertical scrollbars, it works as advertised.  However, no
matter what I do, I cannot get the horizontal scrollbar to work.

Specifically, with the default policy, the horizontal scrollbar is
always there, but it doesn't do anything.  With the "AUTOMATIC"
policy, the horizontal scrollbar is never shown.  I set line wrap to
false, so the scrollbar should appear.  This is gtk+-1.1.16.

I wonder if this is a bug or I'm doing something wrong.  Here is a
test program that fails to work as expected:

#include <gtk/gtk.h>

int
main (int argc, char **argv)
{
  GtkWidget *window;
  GtkWidget *scrolled;
  GtkWidget *text;

  gtk_init (&argc, &argv);

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  scrolled = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
				  GTK_POLICY_AUTOMATIC,
				  GTK_POLICY_AUTOMATIC);
  gtk_container_add (GTK_CONTAINER (window), scrolled);

  text = gtk_text_new (NULL, NULL);
  gtk_text_set_editable (GTK_TEXT (text), 1);
  gtk_text_set_line_wrap (GTK_TEXT (text), 0);
  gtk_container_add (GTK_CONTAINER (scrolled), text);

  gtk_widget_show_all (window);

  gtk_main ();
  return 0;
}



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