Re: [gtk-list] menu



>  im popping up a menu inside of a text box(textarea) when
>  the user clicks in the textarea with the right mouse button.
>  
>  the the mouse event are then trapped so that even after the menu
>  is popped down the mouse events are no longer propagated to the
>  textarea.
>  
>  in my mind there needs to be a way to connect a right mouse click
>  to the popping up of a menu from inside of any widget.

Try something like this:

static gint
button_press (GtkWidget *widget, GdkEventButton *button, gpointer data)
{
	if (button->button != 3)
	        return FALSE;

	gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "button_press_event");
	popup_my_nice_menu ();
	return TRUE;
}

...

gtk_signal_connect (my_text_widget, "button_press_event",
		    (GtkSignalFunc) button_press,
		    NULL);

Good luck,

  Quartic



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