[Mono-osx] KeyEquivalents not working for MonoMac NSMenuItem when used in a GTK# app

Vladimir Dimitrov vlad.dimitrov at gmail.com
Tue Sep 22 09:25:04 UTC 2015


Hello,

I posted this question on stack overflow yesterday too: 
http://stackoverflow.com/questions/32697645/keyequivalents-not-working-for-monomac-nsmenuitem-when-used-in-a-gtk-app

In brief I am trying to run a GTK# application on Mac OS and use MonoMac 
to make it look better. One of the key things I am trying to get rid of 
is the use of libigemacintegration.dylib which we used to integrate the 
GTK# menu with the Cocoa menu. I used MonoDevelop as a code reference 
but I can't make the keyboard shortcuts work for the menu. They show up 
in the menu, but they never get activated. And in MonoDevelop they work 
fine...

This is the sample code I am using:

NSApplication.InitDrawingBridge ();
NSApplication.Init ();

NSMenuItem super = new NSMenuItem (DataHelper.ProductName);
super.Submenu = new NSMenu (DataHelper.ProductName);

NSMenu mainMenu = new NSMenu ();
mainMenu.AddItem (super);

NSApplication.SharedApplication.MainMenu = mainMenu;

< menu initialization comes here >

NSApplication.SharedApplication.Delegate = new AppDelegate ();
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);

Thanks,
  Vladimir


More information about the Mono-osx mailing list