Thanks Tim, but that’s not my point. If a menu is not visible, the associated shortcut should not work either.
Otherwise, it’s a bug to me - unless I’m overlooking something that makes such behavior necessary.
There are times you don’t want the Edit menu to be visible, but you still want Copy/Cut/Paste to work in textfields. Visible and Enabled should be two distinct attributes.
And I tried for myself, to check. My results show that a menu item responds only when it’s both enabled and visible.
Steps I used to reproduce:
• Blank project
• Add a menu item in the “Edit” menu, with a shortcut of “T” (⌘T) and named “EditTest”.
• Add a menu handler for “EditTest”:
self.Title=System.Ticks.ToString
Return True
• Add this in the window’s KeyDown event (quickly written):
if key="E" then EditTest.Enabled=not EditTest.Enabled
if key="V" then EditTest.Visible=not EditTest.Visible
if key="D" or key="V" then
self.Title=if(EditTest.Enabled,"E","D")+if(EditTest.Visible,"V","I")
Return True
end if
• Run the app
• Only when EditTest is both enabled and visible (i.e. the window’s title is “EV” in this example) does Command-T work and shows System.Ticks in the window’s titlebar.
And… I expect it that way. The same behaviour like, say, default push buttons, which won’t react when they’re hidden.
Note to self: always start with the sample that the OP provides.
I can reproduce the behavior with macOS 14.6.1 (⌘L works when visible and not visible)
I can’t reproduce the behavior with macOS 13.6.9 (works as expected, not visible = ⌘L doesn’t work. Menu visible = ⌘L works)
Maybe someone can test and see if this a Xojo or Apple bug?
Did you test the code from first post?
Just to make sure we did the same tests.
If not, can you upload your test code so I can run it in my 14.6.1 macbook?