Scrolling window

Could someone please explain to me why the scrollbars don't work in
the following program? I am using GTK version 1.1.2

#include <gtk/gtk.h>

void destroy (GtkWidget *widget, gpointer data)
  gtk_main_quit ();

int main (int argc, char *argv[])
  GtkWidget *window;
  GtkWidget *scrollwin;
  GtkWidget *tekst, *layout;

  int i;
  gint mask;

  gtk_init (&argc, &argv);
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_signal_connect (GTK_OBJECT (window), "delete_event",
		      GTK_SIGNAL_FUNC (destroy), NULL);
  gtk_signal_connect (GTK_OBJECT (window), "destroy",
		      GTK_SIGNAL_FUNC (destroy), NULL);
  mask = gtk_widget_get_events (window);
  gtk_widget_set_events (window, mask);

  scrollwin = gtk_scrolled_window_new (NULL,NULL);
  gtk_container_add (GTK_CONTAINER (window), scrollwin); 

  layout = gtk_layout_new (NULL,NULL);
  gtk_layout_set_size (GTK_LAYOUT(layout),50,50);
  for (i=1; i<=75; i++)
      tekst=gtk_button_new_with_label ("ashjfaslkdfj");
      gtk_layout_put (GTK_LAYOUT(layout), tekst, 0, 25*i);
      gtk_widget_show (tekst);

  gtk_container_add (GTK_CONTAINER(scrollwin), layout); 

  gtk_widget_show (layout);
  gtk_widget_show (scrollwin);
  gtk_widget_show (window);
  gtk_main ();
  return 0;

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