Re: GtkImage mouse click signal



Perfect, thank you.  I know I saw that somewhere, I just couldn't
remember what it was exactly.

AG

On Tue, 2004-09-07 at 12:37, Brian Clark wrote:

If I understand what you're looking for, I recently had the
samequestion.

Here's what I've got, though it might not be the best way.

First, you have to put your image in an event box, so you can
generateevents when you click on it.  Then you have to connect the
event masksthat you want to be notified about.  The rest is like
hooking up abutton.


    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);


Hope that makes sense....
bc



On Sep 7, 2004, at 10:15 AM, Andy Grebe wrote:

        What is the best way to generate a mouse click signal
        whendealing with
        a GtkImage?  Right now the only way I have of doing this is by
        using
        buttons.  Is there a way to do this if I place the image into
        a
        GtkFixed?  Perhaps get an interrupt when clicking on the
        fixed, then
        grabbing the location of the mouse?
        
        If I missed something in the API or Tutorial, I'll gladly read
        it, if
        you could reference the location.
        
        Thanks
        
        
        -- 
        Andy Grebe
        
        
        _______________________________________________
        gtk-app-devel-list mailing list
        gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
-- 
Andy Grebe
Design Specialist
Network And Video Group
North Wales Facility
Apogee Labs, Inc.

(215)699-2060






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