Can't make Xojo Documentation sample working?

HI all,
I’m follwing this page regarding the build of the menu :
https://documentation.xojo.com/topics/user_interface/desktop/everything_about_desktop_menus.html
reaching the chapter " How to set the action to menus created from code" , I create the new method as mentionned
image
and filled in as is :

Then I try to run, I get this


I tried to move the method under the window “windows1”, different errors. anyway, I understood puting that under the app, it should be global no ?
Thanks

The example shows code from API 1. Change for instance .value to .text. The Action event was renaming to Actionieering (ahem… MenuItemSelected).

Thanks Beatrix,

I understand that we want to create a new “Handler” but it doesn’t accept the name “Action”, while my understading it is that what we are trying to create no ?

I never created a menu like this, so maybe you’re trying something unknow to me.

I add a menu using the Menu Editor (1) and add a Menu Handler in App (Insert → Add MenuHandler I think — sorry I can’t run Xojo right now / memory full).

Is it so ?

(1) Menu Editor is the front image of the video at the link you shared.

well in fact, I’m just trying to define the action when the sub-menu is selected, hence the fact to follow the doc for basic stuff working.
All my menus will be dynamically created ( my understanding is that you just need to create 1 manubar as ref and anchor, and buid around it )

Action is the name of the event in API 1. Change Action to MenuItemSelected.

Dynamically created:

You had to start telling that.

To get what you want, you have to subclass a Menu…

Look for Dynamically created Menus in the documentation.
(unless this was also changed in API2)

Can you re-confirm that this is API1 code in 2022r2 documentation?

Well, I didn’t check the videos. But a cursory glance at Everything about desktop menus — Xojo documentation shows:

Me.Value
Action Event

Both are API1.

1 Like

That’s the tutorial / Explanation page I4m following. Dynamic creation is ok, it’s to link now an action with the menu .
it is , using the documentation term, " the delegation" which doesn’t work for me. IF my understanding is correct ( with my own words ), goal is to create a new “action”, by delegating from another class for this sub menu.
Maybe in that case, there is a nicer / cleaner way to do this ?

For the third time:

Action is the name of the event in API 1. Change Action to MenuItemSelected.

2 Likes

ok, Thanks, get it, from here :


Thanks a lot