Re: 2nd and 3rd mouse button



Fabio Rotondo wrote:
 
  How can I know the mouse button pressed by the user when he/she clicks
on a gtkbutton?
The standard callback does not have this info.

Connect a "press_event" signal to the gtkbutton and write something like
that in the callback:

gboolean
on_button_press_event                  (GtkWidget       *widget,
                                        GdkEventButton  *event,
                                        gpointer         user_data)
{
  switch(event->button) {
    case 1:
      g_print("You've pressed button %d\n", event->button);
      return TRUE;
    case 2:
      g_print("You've pressed button %d\n", event->button);
      return TRUE;
    case 3:
      g_print("You've pressed button %d\n", event->button);
      return TRUE;
  }

  return FALSE;
}

Regards,

Rafael (8-)
-- 
rafael peregrino innominate com
software engineer                                        innominate AG
server appliances                                 the linux architects
tel: +49.30.308806-81  fax: -77              http://www.innominate.com





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