Click to See Complete Forum and Search --> : GtkImage Signals (looking for a mouse click)


tecknophreak
09-07-2004, 08:20 AM
How can I get a GtkImage * to emit a signal when someone hits the mouse button? Or, can I place the Image in a GtkFixed and get a mouse click on that? I can then find the location of the mouse and see if it's clicked on a card or not.

Anyway, here's the layout of what I'm working on so far:

http://www.geocities.com/tecknophreak/fm.jpg

tecknophreak
09-07-2004, 01:30 PM
Just wrap an event box around it

myeventbox = gtk_event_box_new ();
gtk_widget_show (myeventbox);
gtk_container_add (GTK_CONTAINER (frame2), myeventbox);
gtk_widget_add_events(myeventbox, GDK_BUTTON_RELEASE_MASK);
gtk_widget_add_events(myeventbox, GDK_BUTTON_PRESS_MASK);
gtk_widget_add_events(myeventbox, GDK_BUTTON1_MOTION_MASK);

myimage = gtk_image_new_from_pixbuf(/*blah blah*/);
gtk_widget_show (myimage);
gtk_container_add (GTK_CONTAINER (myeventbox), myimage);

Ok, done posting GTK+ Qs here, I finally got around to joining the GTK+ app mailing list. have a good day! :)