hi, gtktable question



Title: hi, gtktable question

Im currently compiling my code using gtk version 1.2.8. im making a large table to display a lot of information and I noticed that gtktable cant handle over a specified number (1639) of rows. 1639 is such a small number that I think either this is a bug, or I’m doing something really dumb. Below is the simple test code:

const int ncells = 1639;

GtkWidget*

create_window2 ()

{

  GtkWidget *window1;

  GtkWidget *vbox1;

  GtkWidget *scrolledwindow1;

 

  window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  gtk_object_set_data (GTK_OBJECT (window1), "window1", window1);

  gtk_window_set_title (GTK_WINDOW (window1), "window1");

  gtk_window_set_default_size(GTK_WINDOW (window1), 800, 800);

  vbox1 = gtk_vbox_new (FALSE, 0);

  gtk_widget_ref (vbox1);

  gtk_object_set_data_full (GTK_OBJECT (window1), "vbox1", vbox1,

                            (GtkDestroyNotify) gtk_widget_unref);

  gtk_widget_show (vbox1);

  gtk_container_add (GTK_CONTAINER (window1), vbox1);

  scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);

  gtk_widget_ref (scrolledwindow1);

  gtk_object_set_data_full (GTK_OBJECT (window1), "scrolledwindow1",

                            scrolledwindow1, (GtkDestroyNotify) gtk_widget_unref);

  gtk_widget_show (scrolledwindow1);

  gtk_box_pack_start (GTK_BOX (vbox1), scrolledwindow1, TRUE, TRUE, 0);

  GtkWidget* table = gtk_table_new (ncells, 2, TRUE);

  gtk_widget_ref (table);

  gtk_object_set_data_full (GTK_OBJECT (window1), "table", table,

                            (GtkDestroyNotify) gtk_widget_unref);

  gtk_widget_show (table);

  gtk_table_set_col_spacings(GTK_TABLE (table), 0);

  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledwindow1), table);

  for (int i = 0; i < ncells; ++i) {

    char framelab[1024], buttonlab[1024];

    sprintf (framelab, "f%d", i);

    sprintf (buttonlab, "b%d", i);

    GtkWidget* frame = gtk_frame_new (NULL);

    gtk_widget_ref (frame);

    gtk_object_set_data_full (GTK_OBJECT (table), framelab, frame,

                              (GtkDestroyNotify) gtk_widget_unref);

    gtk_widget_show (frame);

    gtk_table_attach (GTK_TABLE (table), frame, 0, 1, i, i+1,

                      (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL),

                      (GtkAttachOptions) (GTK_EXPAND | GTK_SHRINK | GTK_FILL), 0, 0);

   

    GtkWidget* label = gtk_label_new (buttonlab);

    gtk_widget_ref (label);

    gtk_object_set_data_full (GTK_OBJECT (frame), buttonlab, label,

                                  (GtkDestroyNotify) gtk_widget_unref);

    gtk_widget_show (label);

    gtk_container_add (GTK_CONTAINER (frame), label);

  }   

  return window1;

}

any help would be greatly appreciated.

Thank you,

john



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