From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Property (As MenuBar )
aWindow.MenuBar = newMenuBarValue
MenuBarValue = aWindow.MenuBar

Supported for all project types and targets.

The menubar that is associated with the window.


This is the MenuBar to use with the window. Typically this is the MenuBar that was added to the project by default, but it can be any MenuBar in your project.

When the window is active, this MenuBar is displayed.

MacOS Info

On macOS, if no MenuBar is assigned to the window, Application.MenuBar is used. To hide the MenuBar, set the MenuBar property to None (in the Inspector) or Nil (in code) for both the window and the Application.

Microsoft Windows and Linux

On Microsoft Windows and Linux, a window can have a MenuBar just below its title bar. The MenuBar assigned to the window is used as the window MenuBar. If the window does not have a MenuBar specified (i.e. it is set to None in the Inspector or Nil in code), then the window will not display a MenuBar.

For MDI applications, the MDI window uses Application.MenuBar as its MenuBar. Individual document windows cannot have a MenuBar (a Windows limitation). However, floating windows can have a MenuBar and these windows use the MenuBar specified in the window.


This code in a PushButton toggles the MenuBar on and off:

If Self.MenuBar <> Nil Then
#If TargetMacOS Then
App.MenuBar = Nil
Self.MenuBar = Nil
#If TargetMacOS Then
App.MenuBar = MainMenuBar

Self.MenuBar = MainMenuBar
End If

See Also

MenuItem, Application.MenuBar property, MenuBar class