Re: Popup menus on a tree view



Thanks
It works perfect and makes the eventbox unneeded.

todd

On 10 Jul 2002 18:38:23 -0300
Gustavo Giráldez <gustavo giraldez gmx net> wrote:

> Hi Todd,
> 
> On Wed, 2002-07-10 at 16:49, Todd Goyen wrote:
> > Hello all,
> > 
> > I am trying to have a "button_press_event" callback on a treeview and searching through the archives I seem to find no mention of this being done. The eventbox_press_event is used to trigger a popup menu on a right click.
> > My code is as follows:
> > 
> >     /*
> >     make eventbox
> >     make treeview
> >     pack treeview in eventbox
> >     */
> >    
> >     gtk_widget_set_events(eventbox, GDK_BUTTON_PRESS_MASK);
> >     g_signal_connect(GTK_OBJECT(eventbox), "button_press_event",
> >             GTK_SIGNAL_FUNC(eventbox_press_event), ca);
> > 
> > then the eventbox_press_event works provided the treeview is empty.
> > as soon as the treeview has something put in it then my press_event stops getting called.  So i thought perhaps if i also:
> > 
> >     gtk_widget_add_events(treeview, GDK_BUTTON_PRESS_MASK);
> >     g_signal_connect(GTK_OBJECT(treeview), "button_press_event",
> >             GTK_SIGNAL_FUNC(eventbox_press_event), ca);
> > 
> > now the callback always works but the treeview no longer recieves mouse events, which i need to have happen as well.
> 
> You need to return FALSE from your event handler to tell Gtk+ to use the
> default handler.  Basically: inspect the event and see if it interests
> you; if it does, do whatever you need and return TRUE to indicate the
> event has been handled; otherwise return FALSE and Gtk will try with the
> next handler installed.  If I'm not mistaken, all events in Gtk behave
> like this.
> 
> HTH,
> Gustavo
> 
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 



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