[Gtk-sharp-list] right click mouse - question

Marco mf74 at gmx.de
Thu May 5 12:04:15 EDT 2011


Connect a "ButtonClickEvent" or usually better a "ButtonReleaseEvent" to 
the tree view.

In the handler code you can check, which mouse was clicked or released:

     protected virtual void OnMyTreeViewButtonReleaseEvent (object o, 
Gtk.ButtonReleaseEventArgs args)
     {
         switch ( args.Event.Button )
         {
         case 1: /*left button*/
             Console.WriteLine( "Left Mouse button released" );
             break;
         case 2: /*middle button*/
             break;
         case 3: /*right button */
             Console.WriteLine( "Right Mouse button released" );
             // add you specialized code here ...
             // e.g.:
             // _myContextMenu.Popup();
             break;
         }
     }

Best regards,
Marco

Am 05.05.2011 17:54, schrieb luca:
> hi all, i've got the gui that contains a treeview
>
> Gtk.TreeView tree = new Gtk.TreeView ();
>
> Gtk.TreeViewColumn column_app = new Gtk.TreeViewColumn();
>
> Gtk.TreeStore stazStore = new Gtk.TreeStore (typeof (string), typeof
> (string));
>
> ///// other code
>
> Gtk.TreeIter stationen = stazStore.AppendValues ("STAZIONI");
> Gtk.TreeIter planned_operation = stazStore.AppendValues ("OPERAZIONI
> PIANIFICATE");
> Gtk.TreeIter users = stazStore.AppendValues ("UTENTI");
>
> now the thing that i would like to know is if i can attach an handler for
> the "right click mouse" when the mouse is over those three TreeIter for
> visualizing a series of option
>
> regards,
> Luca
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/right-click-mouse-question-tp3498724p3498724.html
> Sent from the Mono - Gtk# mailing list archive at Nabble.com.
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20110505/3f7c9574/attachment.html 


More information about the Gtk-sharp-list mailing list