Re: clist and right-clicking



use:

  gtk_signal_connect_after (GTK_OBJECT (clist), "button_press_event",
                            GTK_SIGNAL_FUNC (right_click_cb),
                            (gpointer)NULL);

then right_click_cb does something like:

static gboolean
right_click_cb (GtkWidget* widget,
                GdkEvent* event)
{

  if (event->button.button == 3)
    {
      /* get selected row here, and call something like */
      gtk_menu_popup (GTK_MENU (popup_menu), NULL, NULL,
                      NULL, NULL, 3, event->button.time);
      return TRUE;
    }
  return FALSE;
}
 

In my experience, things don't work as well if you decide to connect to "button_release_event", as I have to waste a click before being able to click on the popup (probably something to do with a part of GTK waiting for another button release event)
 

Henri
 

Michael Rothwell wrote:

Is there any way to capture a right-click on a clist row? I want to pop
up a context menu for the selected row.

Thanks!

-M

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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