Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - MRU List
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

MRU List

 Post Reply Post Reply
Author
Message
nitquest View Drop Down
Newbie
Newbie
Avatar

Joined: 11 September 2006
Location: United States
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote nitquest Quote  Post ReplyReply Direct Link To This Post Topic: MRU List
    Posted: 11 September 2006 at 1:54pm
Hi,
I have a task of disabling the MRU list in File Menu when in one view and enabling it in other. I created the menu in Mainframe OnCreate using :
 

CXTPCommandBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);

however, when I try to diasble the MRU using this function, it wont work. Can someone please help?

if(((CMainFrame *)AfxGetMainWnd())->GetDockingPaneManager()->IsPaneSelected(ID_VIEW_SCRIPT))

return;

// Disable the MRU list if in Jobs Pane

CXTPMenuBar *pMenuBar = ((CMainFrame *)AfxGetMainWnd())->GetCommandBars()->GetMenuBar();

if(pMenuBar != NULL)

{

CMenu* pMenu = pMenuBar->GetMenu();

int nItems = m_pRecentFileList->GetSize();

for (int n = 0; n < nItems; n++)

pMenu->EnableMenuItem(ID_FILE_MRU_FILE1 + n, MF_BYCOMMAND |

MF_GRAYED);

}

pMenu is always NULL. why? How do I access Menu?
Back to Top
sunilwarke View Drop Down
Newbie
Newbie


Joined: 28 September 2006
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote sunilwarke Quote  Post ReplyReply Direct Link To This Post Posted: 29 November 2006 at 4:00am

Hi,

I do have the same problem and still trying to find the solution. Did you get any solution for your problem?

TR,

Sunil

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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: 29 November 2006 at 6:07am
Hello,
Add this  code to you CYourApp
 
ON_UPDATE_COMMAND_UI(ID_FILE_MRU_FILE1, OnUpdateMRUFiles)
...
 
void CCustomThemesApp::OnUpdateMRUFiles(CCmdUI* pCmdUI)
{
 CXTPControl* pControl = CXTPControl::FromUI(pCmdUI);
 if (!pControl)
  return;
 int nIndex = pControl->GetIndex() + 1;
 CXTPControls* pControls = pControl->GetControls();
 while (nIndex < pControls->GetCount())
 {
  CXTPControl* pRecentFile = pControls->GetAt(nIndex);
  if (pRecentFile->GetID() < ID_FILE_MRU_FILE1 || pRecentFile->GetID() > ID_FILE_MRU_FILE1 + 16 )
   break;
  pRecentFile->SetEnabled(FALSE);
  nIndex++;
 }
}
 
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.063 seconds.