Disabled menus with Cocoa windows

We have a plugin that exposes native Cocoa windows to Xojo. Under Carbon, this works fine. Under Cocoa, when one of these native windows is frontmost, all menu items managed by the application (everything except the last few items in the Application menu) are disabled. I have verified that the application’s EventHandler for EnableMenuItems is still called. It would seem that something is disabling the menu items after the EventHandler has run. Has anyone been in a similar situation?

View hierarchies ?
Event loop handling ?
It could be any one of several things and the App EnableMenuItems isn’t the only thing that you need to check

What is it that makes you need a plugin to expose windows ?

Thanks for your comment, Norman. What has me puzzled is that things work fine if I build the app as a Carbon application. It’s when I switch to Cocoa that the menus start to misbehave.

It isn’t clear to me what determines whether a menu item is enabled by Xojo, apart from the invocation of the EnableMenuItems event handler. I don’t see any of our code messing with the event loop. How can view hierarchies influence menu item enabling?

Would a window exposed through the plugin require differences in its REALclassDefinition from what is needed for Carbon?

To be honest without having the plugin & seeing what it does its hard to know precisely whats causing this

And yes Carbon was MUCH more forgiving about things than Cocoa

The plugin is a huge affair; I am going to see if I can pare things down to a minimum and isolate the malfunction. I understand this is almost certainly caused by a mistaken assumption in our code.

File a public feedback report
Then add a note marked “private” & attach a sample app & the compiled plugin
Anyone then can see the report but only you & we can grab the plugin & see whats up

I am working to produce a dummy app that can be run outside of our dev environment, that will exhibit the problem. In the meantime, I have verified that the menus are disabled as a whole during a call to -[NSMenu update]. Autovalidation is turned on and the menu item target is an object of class XOJMenuHandler, which returns NO to -validateMenuItem: when a native window is frontmost.

The difference is in our menu implementation under Cocoa versus Carbon. The Cocoa menu system intentionally disables MenuItems when a non-Xojo modal dialog is being displayed (which seems reasonable) and also when the app’s main window is a non-Xojo dialog. Sadly I can’t remember the reasoning behind why that’s the case, but there may have been unintended consequences of doing it differently.

I’m afraid there’s no supported way to do what you want to do.

Additionally, there’s no reason to produce a dummy app. Just file a feature request asking for this functionality.