ApplicationCommandManager in documentWindow inside mainWindow

Hi,

I have Mainwindow in application. And from menu I am popping up another window which is derived from documentWindow, and it has menuBar also. 

 

But when I try to do following in my document window I am popping up.


getMenuForIndex(int topLevelMenuIndex, const String &menuName)
{
    ApplicationCommandManager* commandManager = &(owner.getCommandManager());

    // other menu creation
}

It compiles fine, 

But it does not work. when i use shortcut to fire that Applicationcommand ? Any Idea why ? I have managed those command Ids in perform function.

Do i have to create new ApplicationCommandManager ? and give also derive from ApplicationCommandTarget ? 

Please guide.