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

Vladimir Giszpenc vladimir.giszpenc at gmail.com
Wed Nov 19 14:56:45 EST 2008


> > 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.

Vlad


More information about the Gtk-sharp-list mailing list