Hi, I'm trying to get notified when the enabled status of the MacOS system undo command changes.
I've gotten a reference to the command via Menu.SystemCommands, and can add it to the menu. The menu item for the command toggles its status as would be expected (when editing text in a TextArea, for example, when it would be possible to undo, the menu item is enabled, but when it is not possible to undo, the menu item is disabled).
I've add a handler for the command's EnabledChanged event, however, it never seems to get called. Also, when I check the command's Enabled property, it appears to always return true when I check it elsewhere.
Contrastingly, for my own custom commands, EnableChanged and Enabled work as expected (using the same style handler for EnabledChanged.
Should this work?
Expected Behavior
EnabledChanged would be called for system commands when their enabled status changes, and Enabled would reflect the current status, as with other commands.
Actual Behavior
As above, the EnabledChanged handler is not called, and the Enabled property doesn't seem to get updated, but then menu item does work as expected.
Steps to Reproduce the Problem
See above
Code that Demonstrates the Problem
Here's roughly the relevant code I'm using in my apps main form (in F#):
let systemUndoCommand =
base.Menu.SystemCommands
|> Seq.find (fun r -> r.ID = "mac_undo")
let systemUndoMenu = systemUndoCommand.CreateMenuItem()
editItem.Items.Add(systemUndoMenu) // add it to my Edit menu
systemUndoCommand.EnabledChanged.Add (fun _ ->
printfn $"System undo enabled changed: {systemUndoCommand.Enabled}"
// ... do something
)
Hi, I'm trying to get notified when the enabled status of the MacOS system undo command changes.
I've gotten a reference to the command via
Menu.SystemCommands
, and can add it to the menu. The menu item for the command toggles its status as would be expected (when editing text in a TextArea, for example, when it would be possible to undo, the menu item is enabled, but when it is not possible to undo, the menu item is disabled).I've add a handler for the command's EnabledChanged event, however, it never seems to get called. Also, when I check the command's Enabled property, it appears to always return
true
when I check it elsewhere.Contrastingly, for my own custom commands,
EnableChanged
andEnabled
work as expected (using the same style handler forEnabledChanged
.Should this work?
Expected Behavior
EnabledChanged
would be called for system commands when their enabled status changes, andEnabled
would reflect the current status, as with other commands.Actual Behavior
As above, the
EnabledChanged
handler is not called, and theEnabled
property doesn't seem to get updated, but then menu item does work as expected.Steps to Reproduce the Problem
See above
Code that Demonstrates the Problem
Here's roughly the relevant code I'm using in my apps main form (in F#):
Specifications