RE: [gtk-list] Trapping a right mouse button click




On 24-Mar-98 David M. Cook wrote:
> How do I trap a right or middle mouse button click on a button? 
> There's 
> an example in the FAQ for a double click, but it is not obvious to
> me 
> how to extend the example to this case.

I think all the info is in the tutorial, just not all in one place.
It depends on what event you hook onto, but the following should give
you an idea:


    if (event->type == GDK_BUTTON_PRESS) {
             GdkEventButton *bevent = (GdkEventButton *) event;
             if (bevent->button == 3)
                 gtk_menu_popup (GTK_MENU(widget), NULL, NULL, NULL,
                             NULL, bevent->button, bevent->time);
             /* Tell calling code that we have handled this event;
              *  the buck
              * stops here. */
             return TRUE;
         }


--
E-Mail: Tony Gale <gale@daedalus.dera.gov.uk>
I never failed to convince an audience that the best thing they
could do was to go away.

The views expressed above are entirely those of the writer
and do not represent the views, policy or understanding of
any other person or official body.



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