How add menuitems in the application menu

Hello,
When I want to add menuitems in the application menu, i have the following message:
You can’t insert items directly into the Apple or Application menu.
How to do ?
Do you know an example source code?
Thanks.

No source code.

Click in:
image

And in the MenuEditor, you can add a MenuItem, a Separator, whatever.

To set the MenuItem in the Application Menu, click in Super: MenuItem pen and you will get:

Thanks but What is “Super” ???

Once you clicked in Main MenuBar, you can read Super in the Inspector (right pane). If not, Cmd-I or Ctrl-I depending on your running OS.

image

So I created a new menu (with the same name as the application) then I put Super in “DesktopApplicationMenuItem”, then I put my submenus (all in Super: DesktopMenuItem).
but the menu does not appear, even compiled. The default menu remains unchanged…

In Xojo 2022r2 ?

NB: you create the MenuItems that will go in Application where you want, Xojo set it where you say (if Super is Application, it will put it in the Application Menu ar run time either in Xojo IDE or stand alone).

Also: I rarely runs Xojo 2022r2. The one that is actually running is 2021r2.1.

Under what OS ?

I use Xojo 2022r1 under macOS Monterey (Apple Silicon) but I don’t think it changes much.

Can you share a simple project who just add the MenuItems ?

I add a MenuItem (named Emile) set the Super to AppleMenuItem, run the project and it appears (unselectable) in the Application Menu.

Monterey 12.5.1 / MacBook Pro m1 / Xojo 2021r2.1.

unselectable: I was awaiting that since I do not add a MenuHandler for this MenuItem.

PS: I think we cannot add an entry in the Apple Menu (anymore).

AppleMenuItem :
This item was deprecated in version 2019r2. Please use :docApplicationMenuItem</api/user_interface/desktop/applicationmenuitem> as a replacement.

But where do we place the code for each sub-menu? there is no “Add event” menu on each menuitem…

There are…

Add Menu Handler… somewhere…

Right-Click in a Window (Window1) or in App and you will eb able to add a Menu Handler:

Maybe it is time to red the Tutorials / Introduction books as PDF…

MenuItem; Sub-Menu is a different beast…