[Gtk-sharp-list] menu on Right click of a TreeView (or descendant)

Adam Tauno Williams awilliam at whitemice.org
Fri Nov 21 11:11:38 EST 2008


On Wed, 2008-11-19 at 14:56 -0500, Vladimir Giszpenc wrote:
> > > On line 461 of ListView.cs.
> >  > if(evnt.Button == 3) {
> >  >   OnMouseButtonClick(new MouseButtonPressedEventArgs(evnt));
> >  >   return true;
> >  > }
> >  OnPopupMenu only fires if right button was clicked and an item is
> >  selected.  So it essentially does this.  One can, of course, connect a
> >  button press event handler using ConnectBefore and override the default
> >  behaviour.   But the processing of a button click/release on the widget
> >  actually turns out to be pretty complicated.  Since you must inherit
> >  from ListView<T> anyway just performing an override of OnPopupMenu seems
> >  correct,  your OnPopupMenu could invoke an event handler if that suits
> >  the purpose.
> I wanted to be able to right click to add rows potentially when none
> were there.

Ah, gotcha.  I'll poke at their ListView this weekend and see if it has
such a capacity, and if not how cleanly it can be extracted from Hyena.



More information about the Gtk-sharp-list mailing list