Re: how to click on a drawing area ?



Sebastien Delestaing wrote:

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("gweled.glade", 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);

add the following command:
   gtk_widget_add_events(GTK_WIDGET(drawing_area), GDK_BUTTON_PRESS_MASK);

James.

--
Email: james daa com au              | Linux.conf.au 2003 Call for Papers out
WWW:   http://www.daa.com.au/~james/ |   http://conf.linux.org.au/cfp.html






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