[Gtk-sharp-list] popup menu (combobox?) for treeview?

Adam Tauno Williams awilliam at whitemice.org
Fri May 22 10:36:35 EDT 2009


On Fri, 2009-05-22 at 07:20 -0700, danieru wrote:
> Thanks Spoody and Michael, I've got my context menu popping up for a
> right-click on the treeview! 
> Now I'm trying to figure out how to show specific menu items, depending on
> what row the user right-clicked on. (otherwise it wouldn't be a context
> menu, right;^) The problem I'm having is the Gtk main loop doesn't seem to
> get around to handling the selection changed event until after it's finished
> handling my popup event handler. The result of this is that my menu options
> are one iteration behind what the user just selected. (e.g. When I right
> click in sequence on row x, then row y, then row z, I'm given a context menu
> for 'no' row, then x, then y, respectively). I'm verifying this by some
> console.writelines: the selectionChanged is always getting executed after
> the popup method executes.

This is working for me, at least with a NodeView.

[GLib.ConnectBefore]		
public void OnButonPressEvent(object_sender, ButtonPressEventArgs args)
{
  ITreeNode	node;
  Enterprise	enterprise;

  if (PopupEnabled) {
    /* Get the selected list node from the nodeview
       and bail out if result is not a EnterpriseListNode */
    node = (_sender as NodeView).NodeSelection.SelectedNode;
....



More information about the Gtk-sharp-list mailing list