![]() |
How to get submenu control? |
Post Reply
|
| Author | |
hikaroute
Groupie
Joined: 05 September 2007 Status: Offline Points: 51 |
Post Options
Thanks(0)
Quote Reply
Topic: How to get submenu control?Posted: 22 February 2008 at 3:37am |
|
Hi oleg,
again that I have problem to you. But this problem is the big for me. Now I need to get the sub menu control from my main menu. like this.
&File
- &New
- &Open
- &Save
- E&xit
I make menu from XTPMenuBar.
Now I want to get the control that contain submenu like "New" or "Open" to set the new icon on it, change name or set enable/disable.
Thank you so much.
|
|
![]() |
|
Simon HB9DRV
Senior Member
Joined: 07 July 2005 Location: Switzerland Status: Offline Points: 458 |
Post Options
Thanks(0)
Quote Reply
Posted: 22 February 2008 at 3:47am |
|
Here's what I do, formatting is lost when pasting here :-(
//
// Popup a menu. // void CMainFrame::TrackPopupMenu(const CString& strTitle, const CPoint& point) { CXTPCommandBars* pCommandBars = MainFrame().GetCommandBars(); CXTPMenuBar* pMenuBar = pCommandBars->GetMenuBar(); int nMenuCount = pMenuBar->GetControlCount(); int nIndex = 0; CXTPCommandBar* pChildCommandBar = NULL; //
// Find menu. // for (nIndex = 0; nIndex < nMenuCount; nIndex++) { CXTPControl* pControl = pMenuBar->GetControl(nIndex); CString strCaption = pControl->GetCaption(); TRACE(_T("Menu %d [%s]\n"), nIndex, strCaption);
strCaption.Remove(_T('&'));
if (strCaption.CompareNoCase(strTitle) == 0)
{ pChildCommandBar = pControl->GetCommandBar(); break; } } //
// Owner. // if (pChildCommandBar != NULL) { CWnd* pWndPopupOwner = &MainFrame(); CXTPCommandBars::TrackPopupMenu((CXTPPopupBar*)pChildCommandBar,
TPM_RIGHTBUTTON, point.x, point.y, pWndPopupOwner, 0, 0); } } |
|
|
Simon HB9DRV
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |