Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - GetMenu doubt in commandbar?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

GetMenu doubt in commandbar?

 Post Reply Post Reply
Author
Message
Ashok View Drop Down
Senior Member
Senior Member


Joined: 02 May 2007
Status: Offline
Points: 164
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ashok Quote  Post ReplyReply Direct Link To This Post Topic: GetMenu doubt in commandbar?
    Posted: 14 January 2008 at 6:58am
Hi,
 What is the equivalent code for this statement in the CommandBar
       m_pMainWnd->GetMenu();
 because it returns NULL in my application. Please help.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 14 January 2008 at 9:37am

Hi,

There is no HMENU in CommandBars.
use GetCommandBars()->GetMenuBar() to get pointer to menubar. but its not CMenu.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
mihey View Drop Down
Groupie
Groupie
Avatar

Joined: 14 May 2003
Location: Germany
Status: Offline
Points: 45
Post Options Post Options   Thanks (0) Thanks(0)   Quote mihey Quote  Post ReplyReply Direct Link To This Post Posted: 28 January 2008 at 4:29am

Hi Ashok,

You are not the first one who ask about this. Maybe Codejock guys have to consider making a solution for this.

I also had the same problem and had to patch CXTPCommandBar and CXTPMenuBar a little bit. I've made it in this way because I did not want to change handling of menus in my application which was very complex due to exposing an object model via COM and based on old version of XtremeToolkit where GetMenu worked.  

 

In XTPCommandBar.h I added member

 

HMENU                         m_hLoadedMenu;

 

 

In XTPCommandBar.cpp I added before return

 

BOOL CXTPCommandBar::LoadMenu(CMenu* pMenu, BOOL bRemoveControls)

{

           

            // ----

            if (bRemoveControls) m_hLoadedMenu=pMenu->m_hMenu;

            // ----

            return TRUE;

}

 

 

In XTPMenuBar.h I just defined method

 

CMenu* GetMenu( ) const;

 

And added the implementation in XTPMenuBar.cpp

 

CMenu* CXTPMenuBar::GetMenu() const

{

            return CMenu::FromHandle(m_hLoadedMenu);

}

So, now I can acces loaded menu via GetCommandBars()->GetMenuBar()->GetMenu() and it works fine for me but I have to pach it in each new version of XTP.  Of course this is not a universal method but at least it works in case of loading menus from recourses.

 Best regards, Mikhail
Back to Top
Ashok View Drop Down
Senior Member
Senior Member


Joined: 02 May 2007
Status: Offline
Points: 164
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ashok Quote  Post ReplyReply Direct Link To This Post Posted: 28 January 2008 at 8:06am
Hi, Thanks a lot.
Back to Top
Ashok View Drop Down
Senior Member
Senior Member


Joined: 02 May 2007
Status: Offline
Points: 164
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ashok Quote  Post ReplyReply Direct Link To This Post Posted: 05 February 2008 at 7:03am
I have uploaded a file which contains my doubt.please look into this issue.uploads/20080205_070302_test.rar
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 05 February 2008 at 12:54pm
Hi,
 
Most our samples in CommandBars forlder show MDI/Default menus.
 
Please look all CommandBars samples.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Ashok View Drop Down
Senior Member
Senior Member


Joined: 02 May 2007
Status: Offline
Points: 164
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ashok Quote  Post ReplyReply Direct Link To This Post Posted: 06 February 2008 at 12:19am
Hi, I understand that all your commandbar samples are having MDI Menu. My problem is when ever there is a MDIActive(means window list will have Data1,Page1etc.,),I have to set my full menu, if there is nothing in the window list(means if i closed all my active view) I have to set another menu. Please help.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 06 February 2008 at 9:02am
Hello,
Yes and our samples show it. Seriously 120 messages and you have no idea what CommandBars can do. Please check all samples and try to understand how they work.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.043 seconds.