Print Page | Close Window

MRU List

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=5023
Printed Date: 08 November 2025 at 1:29am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: MRU List
Posted By: nitquest
Subject: MRU List
Date 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?



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



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



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