Two menubar in one application


#1

Hi,

I want to know, is it possible to have two menu bar in one application ?

like one in main window and other in some non modeled dialog window. 

Actually i tried but I am having some issue, when 

In some non model dialog window, 

which look something like following

class XWindow   : public DocumentWindow, 
    private KeyListener,
    public MenuBarModel,
    public ApplicationCommandTarget
{
public:
// derived methods 
private:
MenuBarComponent*           m_pMenuBar;
    // The command manager object used to dispatch command events
    ApplicationCommandManager   m_oCommandManager;

}


XWindow::XWindow(const String& name,
    const Colour& backgroundColour,
    int requiredButtons,
    bool addToDesktop ): DocumentWindow (name,
    backgroundColour,
    requiredButtons,
    addToDesktop ) , m_pMenuBar(new MenuBarComponent(this))
    {
        setTitleBarTextCentred( false );
        addKeyListener(this);
        setMenuBar(this);

       m_oCommandManager.registerAllCommandsForTarget(this);

    }

this is class which i am using to put some component to show in non model window, which are created in MainWindow it self.

My mainWindow has same Menubar and ApplicationCommandManager , that is working fine, And this whole code is compiled fine, but runtime before starting up, 
m_oCommandManager.registerAllCommandsForTarget(this); line in constructor fails and application does not start from here.

 

Thanks.
 


#2

Probably not going to work with an OSX native menu, but probably ok if you're using lightweight menus (though I've never tried it). Can't really tell from your description what's going wrong though.