GtkTable and GtkDrawingArea

Hi --

I'm new to GTK and am having problems that I don't understand ... thanks in advance to anyone who can take a look ...

I'm trying to use a GTKTable (created by Glade, and without any child widgets) to lay out a group of GtkDrawingAreas. The table itself is 3x2 cells, around 500x200 pixels, and homogeneous is set true.

The problem is that when I create a new GtkDrawingArea, attach it to a cell, and then make the GtkDrawingArea visible, the configure_event handler seems to see that the GtkDrawingArea is only 1x1 ... it should be something like 166x100.

What could I be doing wrong?? Here's the gist of what I'm doing:

==== main program ====
GtkWidget *newArea = gtk_drawing_area_new();
gtk_widget_set_name (newArea, "drawingarea2");
g_signal_connect(G_OBJECT(newArea),"configure_event", G_CALLBACK(map_configure_event), 0);

gtk_table_attach_defaults(myTable, newArea, 0, 1, 0, 1);

==== Configure Event Handler ====
gboolean map_configure_event(GtkWidget *widget, GdkEventConfigure *event) {
g_print("%dx%d\n", widget->allocation.width, widget->allocation.height);

... I would have thought that the allocation width and height would have been set when the drawing area was attached to the table ... to 166x100. But instead this handler is showing 1x1.

I'm somewhat new to GTK, so I can easily believe that I'm missing something easy or dumb.

Can anyone help out??


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