Print Page | Close Window

About CXTPMenuBar

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=17482
Printed Date: 28 April 2024 at 2:41pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: About CXTPMenuBar
Posted By: kmustty
Subject: About CXTPMenuBar
Date 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!
 



Replies:
Posted By: Oleg
Date Posted: 26 October 2010 at 2:53am
Hi,

You want access specific control and get its caption ?


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: kmustty
Date 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



Posted By: Oleg
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net