Menu Bar Not Showing?


#1

I’m trying to add a simple menu bar to my juce app following juce demo, but it’s not showing? Did the following

class HelloWorldContentComponent : public Component, public MenuBarModel . . ect

Then all the required pure virtuals

getMenuBarNames()
const PopupMenu getMenuForIndex(int menuIndex, const String&menuName)
menuItemSelected(int menuItemID,int topLevelMenuIndex)

The problem is no menu system comes up, what’s missing? Thanks…


#2

You need to add something like this in your class constructor :

#if JUCE_MAC
    setMacMainMenu (this);
#else
    setMenuBar (this, 20);
#endif

The conditional is here to use a true system menu on Mac. Whithout it (ie doing only setMenuBar (this, 20)) then there is an extra menu attached to the main window, something that we don’t see ususally in a mac app

Hope this helps
Robert


#3

cheers rbocquier! It’s showing now.