NSMenu confusion :(

I created a custom control that uses NSMenu…

In one window it works just fine…
in another window … using the EXACT same code syntax … all the menu items are grayed out.
Normally this means that no action has been assigned to the menu item… but that is not the case, as the action is a function inside the custom control , therefore the instance on each window would be using the exact same code.

But everything is “acting” like there is no action

here is a portion of the code that adds the items,

public final func addRow(_ item : String) {
		if item=="-" {
		} else {
			let menuItem       = NSMenuItem(title: item,action: #selector(self.popUpClicked(_:)),keyEquivalent: "")
			menuItem.target    = self // IMPORTANT, otherwise it looks into the responders chain
			menuItem.isEnabled = true

	@objc func popUpClicked(_ sender:NSMenuItem){
		if sender.title != lbl.stringValue {
			lbl.stringValue = sender.title
			self.delegate?.changed(self, text:text)
			self.delegate?.changed(self, index:listIndex)

Not sure why this is… but the control instance that DOES not work is on a NSWindow that is supposed to be a “dialog” type box. If I use SHOWMODAL, the control does not work… it I use just “SHOW” it does.

And it also works on SHEET windows

Confusing to say the least

and your showmodal create a new event loop etc that can respond to the menu selection ?

not sure I understand your question…
But this is a nightmare to be sure.

I got textfields to work on a sheet menu by adding
override var canBecomeKey: Bool { return true }

But now (sigh)… another issue… As the user selects items from the dropdown, fields appear/disappear based on that selection… some selections might change the height of the dialog… as soon as I do that… it detachs from the app window and moves away