PopupMenu on Gtk #

I have a scrollable Gtk window that I am also trying to connect to the PopupMenuHandler function:

this.scrolledwindow1.PopupMenu += HandlePopupMenu;

and HandlePopupMenu looks like this:

[GLib.ConnectBefore]
public void HandlePopupMenu(object o, PopupMenuArgs args)
{
   Console.WriteLine("test");
   Gtk.Menu mbox = new Gtk.Menu();
   Gtk.MenuItem Test = new Gtk.MenuItem("test");
   Test.Activated += delegate(object sender, EventArgs e) {
      Console.WriteLine("test");
   };
   mbox.Append(Test);
   mbox.ShowAll();
   mbox.Popup();    
}

My problem is that this event is never fired when I right-click on a scrollable window. which I suppose should be based on this . There is only one other event in ScrollEvent, and nothing happens with the keyboard or mouse buttons. Can someone tell me why this is not working?

+3
source share
1 answer

1) GtkScrolledWindow, - . , , , .

2) PopupMenu (Shift + F10 ), . GtkStatusIcon GtkWidget, -.

ButtonPressEvent PopupMenu, . GTK + (C, # ).

+2

Source: https://habr.com/ru/post/1712862/


All Articles