Getting App.MenuBar Text and Name properties

I am unable to get neither of MenuBar.Text and MenuBar.Name.

I consistently get a blank string.
Used code (to be sure of what I will get):
MsgBox App.MenuBar.Text + EndOfLine + App.MenuBar.Name

Created with 2015r12 and also tested with 2015r2.2, running in the IDE.

Am I right / what do I do wrong ?

Also: why in this conversation MenuBar “.Name” appears as links ?

.name is a valid top level domain like .com or .net, so esotalk thinks it is a link. Make it code to prevent that.

[quote=196139:@Emile Schwarz]I am unable to get neither of MenuBar.Text and MenuBar.Name.

I consistently get a blank string.
Used code (to be sure of what I will get):
MsgBox App.MenuBar.Text + EndOfLine + App.MenuBar.Name

[/quote]

Look at the LR
http://documentation.xojo.com/index.php/MenuItem.Name and http://documentation.xojo.com/index.php/MenuItem.Text
The example clearly indicate these properties to be for MenuItems. Like

EditFind.text="Find..."

Apparently MenuBar is considered by Xojo as a MenuItem, but it has no name or text visible. It is possible to set those values, though. No idea what one could do with that…

[code] App.MenuBar.Text = “fric”
App.MenuBar.Name = “frac”
MsgBox App.MenuBar.Text + EndOfLine + App.MenuBar.Name

[/code]

They are present, because MenuBar is a subclass of MenuItem. The Text property has to be empty as there is no text to show for the menu bar. The Name property could return the “MenuBar1”, but I never needed that. If you need it, you could set it (it is a read-write property).

Thank you Michel and Eli for your answers.

But, Xojo reports these in the Menu Editor:

ID
Name --> “MainMenuBar”

So, no Text property (I was wrong for this one).

I was thinking that the MenuBar have to have a reference: so one who have many MenuBars can call them. Now, the real question is: Can we have many different MenuBars in an application ?

Yes, Michel: I forgot to set the Code… to be looking like Code… Where goes my head at that moment ? I do not know !!

The answer is yes. You can have as many menu bars as you want and switch them at will. That said, if this is alright on Windows as menus are attached to each window, Apple HIG recommend to keep the same menu, and simply enable or disable options.

Time ellapsed, but AppleWorks (the Mac OS version) had “contextual” menus depending on the module you were working on.

That said, I do not know how they do that (but I suspect they used one MenuBar for each module).

[quote=196404:@Emile Schwarz]Time ellapsed, but AppleWorks (the Mac OS version) had “contextual” menus depending on the module you were working on.

That said, I do not know how they do that (but I suspect they used one MenuBar for each module).[/quote]

It can make sense to have different menus in a Word Processor, a Spreadsheet and a Database.

As I said, it is easy to do with several menu bars, but current HIG discourage it. And all so very often Apple apps do things that are frowned upon in the HIG. That said nothing prevents you from doing the same.

In the current version of Apple office applications, the problem has been solved by simply having modules replaced by separate applications : Pages, Numbers, etc.