Menu bar items and associated hotkeys work the same in Dialog windows and regular Form windows.
Actual Behavior
Menu bar items work correctly in Form windows, but are always disabled in Dialog windows. In addition it appears that (copy/paste/cut) menu bar hotkeys from the main window propagate to a Dialog window, until the menu bar is clicked once after which the hotkeys are no longer available.
This problem might be related to https://github.com/picoe/Eto/issues/936, however the menu items work correctly in the main form after closing the dialog window.
Steps to Reproduce the Problem
Run test program, focus text box, press Cmd+a, Cmd+x, Cmd+v, this all works. Same for the Edit menu.
Click Open dialog
Focus text box, press Cmd+a, Cmd+x, Cmd+v, this all works.
Click the Edit menu, items are disabled. Focus the text box again, press Cmd+a, this no longer works.
Click the application menu, the "Test" item is disabled.
Code that Demonstrates the Problem
using System;
using System.IO;
using Eto.Forms;
using Foundation;
namespace TestApp.XamMac {
class Program {
static void Main(string[] args) {
var app = new Application(Eto.Platforms.XamMac2);
((Eto.Mac.Forms.ApplicationHandler)app.Handler).AllowClosingMainForm = true;
app.Run(new TestForm());
}
}
class TestForm : Form {
public TestForm() : base() {
Menu = new MenuBar() { IncludeSystemItems = MenuBarSystemItems.All };
Content = new StackLayout(
new TextArea() { Text = "Text" },
new Button((s, e) => (new TestForm() { Owner = this }).Show()) { Text = "Open form" },
new Button((s, e) => (new ModalForm()).ShowModal(this)) { Text = "Open dialog" }
);
}
}
class ModalForm : Dialog {
public ModalForm() : base() {
Menu = new MenuBar() { IncludeSystemItems = MenuBarSystemItems.All };
Menu.ApplicationItems.Add(new ButtonMenuItem() { Text = "Test" });
Content = new StackLayout(
new TextArea() { Text = "Text" }
);
}
}
}
Expected Behavior
Menu bar items and associated hotkeys work the same in Dialog windows and regular Form windows.
Actual Behavior
Menu bar items work correctly in Form windows, but are always disabled in Dialog windows. In addition it appears that (copy/paste/cut) menu bar hotkeys from the main window propagate to a Dialog window, until the menu bar is clicked once after which the hotkeys are no longer available.
This problem might be related to https://github.com/picoe/Eto/issues/936, however the menu items work correctly in the main form after closing the dialog window.
Steps to Reproduce the Problem
Code that Demonstrates the Problem
Specifications