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

Marco mf74 at gmx.de
Mon May 9 04:32:05 EDT 2011


Hi Luca,

Not sure what you want to say with iter versurs "rows item".
However, there is something that I think does what you want - no reason 
to get angry anyways :-)

Tree.Selection
-> This contains the selected "rows" = item(s) of the tree view

So, if you want the iter, this is one option:

     // TreeView tv;    -- for example
     TreeIter iter;

     if ( tv.Selection.CountSelectedRows() > 0 )    // make sure 
something is selected ... otherwise you get an exception below
     {
         tv.Model.GetIter( out iter, tv.Selection.GetSelectedRows()[0] 
);    // get the iter of the first selected row - probably the ONLY 
selected row
     }
     else
     {
         // ignore or do something to handle the case that nothing is 
selected
     }


This works in so far, as it gives you the iter of the item that was 
right-clicked if you use it in that context...

Best regards,
Marco


Am 09.05.2011 09:13, schrieb luca:
> hi,
> i wanna just enabling right click on TreeIter, not on rows item (read only
> treeview on "right side" of tree)
> the fact that that there is no "Tree.treestore.getSelectedIter (or something
> like that, and the fact that on left click on the tree on a treeIter make
> expand the tree as standard behaviour) make me angry.


More information about the Gtk-sharp-list mailing list