temp disable of MRU items
Ed Jennings -- edj@whidbey.com Monday, August 26, 1996 Environment: VC++ 4.1, Windows NT 3.51 I have a SDI application with a most recently used file list. I used app wizard to generate my application and I have been letting MFC do all the MRU management. Sometimes I want all of the MRU items to be gray and not available for selection. I've used class wizard to generate a message map entry for the MRU: ON_UPDATE_COMMAND_UI(ID_FILE_MRU_FILE1, OnUpdateFileMruFile1) and then added pCmdUI->Enable(TRUE) and pCmdUI->Enable(FALSE) to the OnUpdateFileMruFile1() function. The MRU gets reduced to just one item "Recent File" instead of having the actual file names. So I want to know if there is a way I can enable/disable the MRU menu items and still have MFC do most of the MRU file list management? - Ed ==================================================== Ed Jennings Email: edj@whidbey.com Jennings & Associates 6215 S. Windfall Rd. Voice: 360-341-3868 Clinton, WA 98236 ====================================================
Jerry Krupa -- jkrupa@ix.netcom.com Thursday, August 29, 1996 [Mini-digest: 2 responses] In message <199608262107.OAA10650@whidbey.whidbey.com> , From Ed Jennings, the following was written: > Environment: VC++ 4.1, Windows NT 3.51 > > I have a SDI application with a most recently used file list. I used > app wizard to generate my application and I have been letting MFC do > all the MRU management. Try using: ON_UPDATE_COMMAND_UI_RANGE (ID_FILE_MRU_FILE1, ID_FILE_MRU_FILE16, OnUpdateFileMruFile1) instead of the single MRU message map entry. -- -- Jerry Krupa, jkrupa@ix.netcom.com AKA 72147.3520@compuserve.com Written 08/29/96 @ 07:39 -----From: Simon Dong Ed, You are almost there. You need to put ON_UPDATE_COMMAND_UI_RANGE(ID_FILE_MRU_FILE1, ID_FILE_MRU_FILE4, OnUpdateFileMruFile1) into your message map. Then in your OnUpdateFileMruFile1() you do the enabling/disabling accordingly. -Simon Dong Quintus Corp. simon.dong@quintus.com
Ed Jennings -- edj@whidbey.com Sunday, September 01, 1996 Here's what I did to solve my problem of not being able to enable/disable the MRU menu items. 1) Added the function OnUpdateFileMruFile1() to my class that is derived from CWinApp. 2) Added: ON_UPDATE_COMMAND_UI_RANGE (ID_FILE_MRU_FILE1, ID_FILE_MRU_FILE16, OnUpdateFileMruFile1) to my message map. 3) Put this code in my OnUpdateFileMruFile1() function: // if there are no MRU files or currently executing measurements if ((m_pRecentFileList == NULL) || (m_executingMeas == TRUE)) pCmdUI->Enable(FALSE); else m_pRecentFileList->UpdateMenu(pCmdUI); The code I added to OnUpdateFileMruFile1() is similar to the same code that is in CWinApp's OnUpdateRecentFileMenu(). Thanks go to Simon Dong and Jerry Krupa for pointing out the need for the ON_UPDATE_COMMAND_UI_RANGE code. >Environment: VC++ 4.1, Windows NT 3.51 > >I have a SDI application with a most recently used file list. I used app >wizard to generate my application and I have been letting MFC do all the >MRU management. > >Sometimes I want all of the MRU items to be gray and not available for >selection. > >I've used class wizard to generate a message map entry for the MRU: > > ON_UPDATE_COMMAND_UI(ID_FILE_MRU_FILE1, OnUpdateFileMruFile1) > >and then added pCmdUI->Enable(TRUE) and pCmdUI->Enable(FALSE) to the >OnUpdateFileMruFile1() function. > >The MRU gets reduced to just one item "Recent File" instead of having the >actual file names. > >So I want to know if there is a way I can enable/disable the MRU menu items >and still have MFC do most of the MRU file list management? > - Ed ==================================================== Ed Jennings Email: edj@whidbey.com Jennings & Associates 6215 S. Windfall Rd. Voice: 360-341-3868 Clinton, WA 98236 ====================================================
| Вернуться в корень Архива |