Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - About CXTPMenuBar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

About CXTPMenuBar

 Post Reply Post Reply
Author
Message
kmustty View Drop Down
Newbie
Newbie


Joined: 25 October 2010
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote kmustty Quote  Post ReplyReply Direct Link To This Post Topic: About CXTPMenuBar
    Posted: 25 October 2010 at 10:37am
I use the following code to create a menubar
code:
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  return -1;
 if (!m_wndStatusBar.Create(this) ||
  !m_wndStatusBar.SetIndicators(indicators,
  sizeof(indicators)/sizeof(UINT)))
 {
  TRACE0("Failed to create status bar\n");
  return -1;      // fail to create
 }
 if (!InitCommandBars())
  return -1;
 CXTPPaintManager::SetTheme(xtpThemeRibbon);
 CXTPCommandBars* pCommandBars = GetCommandBars();
 CXTPMenuBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);
 pMenuBar->SetFlags(xtpFlagIgnoreSetMenuMessage);
 pMenuBar->EnableDocking(xtpFlagAlignTop); 
 pMenuBar->ModifyBarStyle(CBRS_GRIPPER, 0);
 
The resource menu  IDR_MAINFRAME I have already modified some of the submenu name. Now,
I want to get the submenu name of menubar(menu  IDR_MAINFRAME ), how can I code? Thx for 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: 26 October 2010 at 2:53am
Hi,

You want access specific control and get its caption ?
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
kmustty View Drop Down
Newbie
Newbie


Joined: 25 October 2010
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote kmustty Quote  Post ReplyReply Direct Link To This Post Posted: 26 October 2010 at 6:39am

Yes. The project requires such an operation . I spent some time to study ,I found that the menu is not the normal menu which can't get its CMenu pointer. So can you put forward a solution to the problem? I got fred some days. thx

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: 27 October 2010 at 4:11am
Hi,

Yes, CXTPMenuBar is not CMenu and use own methods to change/access/delete controls

you need first get pointer to file control:

CXTPControl* pFile = pMenuBar->GetControl(0);

and now can access control inside CommandBar of "File" control:

CXTPControl* pSomeControl = pFile->GetCommandBar()->GetControl(nIndex);

now you can change its caption pSomeControl->SetCaption("New Caption");
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.141 seconds.