how to click on a drawing area ?

I feel stupid... I just can't click on a drawing area:

1. I create a gnome_app in glade2, and a drawing area.
2. I create 2 event_handler for the drawing area: expose and press_button
3. Then I do this in my program:


xml = glade_xml_new("", NULL, NULL);
//glade_xml_signal_autoconnect(xml);                  // doesn't work for some reason

glade_xml_signal_connect(xml, "on_drawingarea1_expose_event", (GCallback)expose_event_cb);        //works
glade_xml_signal_connect(xml, "on_drawingarea1_button_press_event", (GCallback)drawing_area_button_press_event_cb);   //seems to work

drawing_area = glade_xml_get_widget(xml, "drawingarea1"); 
gtk_widget_set_size_request (GTK_WIDGET (drawing_area), BOARD_WIDTH * TILE_WIDTH, BOARD_HEIGHT * TILE_HEIGHT);


void drawing_area_button_press_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
switch (event->type)
printf("button pressed\n");
printf("something happened\n");

gint expose_event_cb (GtkWidget *widget, GdkEventExpose *event)
gdk_draw_drawable (GDK_DRAWABLE (widget->window), widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
buffer_pixmap, event->area.x, event->area.y, event->area.x, event->area.y,
event->area.width, event->area.height);

return (FALSE);

Sebastien Delestaing <sebastien delestaing wanadoo fr>

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