Enabling Menu Items
-
Hi, I have an MDI application with views derived from CHtmlView, and my problem is with Undo,Cut, and Copy menu items under the Edit menu, which is always found disabled. Can anyone tell me how can I enable those menu items when a selection is made in the view. Thanks and Regards Jugs "A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
-
Hi, I have an MDI application with views derived from CHtmlView, and my problem is with Undo,Cut, and Copy menu items under the Edit menu, which is always found disabled. Can anyone tell me how can I enable those menu items when a selection is made in the view. Thanks and Regards Jugs "A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
Handle an ON_UPDATE_COMMAND_UI message for appropriate IDs (ID_EDIT_UNDO etc.) Robert-Antonio
-
Hi, I have an MDI application with views derived from CHtmlView, and my problem is with Undo,Cut, and Copy menu items under the Edit menu, which is always found disabled. Can anyone tell me how can I enable those menu items when a selection is made in the view. Thanks and Regards Jugs "A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
Handle each menu item in your CHTMLView derived class like: [...] ON_COMMAND(ID_EDIT_CUT, OnEditCut) ON_COMMAND(ID_EDIT_COPY, OnEditCopy) ON_COMMAND(ID_EDIT_PASTE, OnEditPaste) ON_COMMAND(ID_EDIT_SELECTALL, OnEditSelectAll) [...] Below is the implementation for each member function: void CWebView::OnEditCut() { ExecWB(OLECMDID_CUT, OLECMDEXECOPT_DONTPROMPTUSER, NULL, NULL); } void CWebView::OnEditCopy() { ExecWB(OLECMDID_COPY, OLECMDEXECOPT_DONTPROMPTUSER, NULL, NULL); } void CWebView::OnEditPaste() { ExecWB(OLECMDID_PASTE, OLECMDEXECOPT_DONTPROMPTUSER, NULL, NULL); } void CWebView::OnEditSelectAll() { ExecWB(OLECMDID_SELECTALL, OLECMDEXECOPT_DONTPROMPTUSER, NULL, NULL); } I got this code from an article somewhere, but unfortunately, I can't find where the article is again. Anyway, this should help you out. :) Happy Programming! WWW::CodeProject::BNEACETP