Solved

not to disable undo menu

Posted on 2002-04-03
3
289 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
Comment Utility
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
Comment Utility
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
Comment Utility
// 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now