Solved

not to disable undo menu

Posted on 2002-04-03
3
296 Views
Last Modified: 2013-11-20
In CEditView, if  I select some text and cut it, my Undo menu gets disabled. Also my toolbar button to handle Undo command gets greyed. I want to control the enable/disable of these by myself. How can I do it?
0
Comment
Question by:britney
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
mblat earned 100 total points
ID: 6915672
first you need to set

m_bAutoMenuEnable  = FALSE;

it is member of CFrameWnd, so if you are using standard SDI/MDI app you can do it in CMainFrame constractor

Downside here is that now you need to overwrite UPDATE_COMMAND_UI handler for EVERY menu item you want to enable/disable based on certain conditions.

something like this:

void CMainFrame::OnUpdateFileLogon(CCmdUI* pCmdUI)
{
     if (SecurityDLL_IsUserLoggedOn())
          pCmdUI->Enable(FALSE);
}
otherwise they will always be enabled.

Hope it helps
0
 

Author Comment

by:britney
ID: 6915934
hi mblat,
I set m_bAutoMenuEnable  = FALSE; in constructor of my CMainFrame. It still disables the menu and toolbar button on using Cut. It's ok for  me if they never get disabled. Comment with m_bAutoMenuEnable in AFXWIN.H says:

BOOL m_bAutoMenuEnable;
          // TRUE => menu items without handlers will be disabled

I think this is for automatic enabling/disabling of menu items with/without handlers. What I need is the  menu item never gets automatically disabled.



0
 
LVL 4

Expert Comment

by:mblat
ID: 6916197
// TRUE => menu items without handlers will be disabled

so, did you define handler?  try to define it and then try to define UPDATE_COMMAND_UI handler.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question