Click here to Skip to main content
14,669,125 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Open the file but do not save the args Pin
k505414-Jan-16 3:52
mvek505414-Jan-16 3:52 
AnswerRe: Open the file but do not save the args Pin
honor3us15-Jan-16 2:44
Memberhonor3us15-Jan-16 2:44 
SuggestionRe: Open the file but do not save the args Pin
David Crow15-Jan-16 3:49
MemberDavid Crow15-Jan-16 3:49 
Questiondoubt in typdef segregation one class in two Pin
narsi8112-Jan-16 18:50
Membernarsi8112-Jan-16 18:50 
SuggestionRe: doubt in typdef segregation one class in two Pin
Jochen Arndt12-Jan-16 20:53
professionalJochen Arndt12-Jan-16 20:53 
QuestionVisual Studio 2016 & MFC Pin
BarryPearlman11-Jan-16 16:54
MemberBarryPearlman11-Jan-16 16:54 
AnswerRe: Visual Studio 2016 & MFC Pin
Jochen Arndt11-Jan-16 20:52
professionalJochen Arndt11-Jan-16 20:52 
QuestionMFC, Cannot disable Menu option from Child View Pin
Member 1120327711-Jan-16 4:30
MemberMember 1120327711-Jan-16 4:30 
I have added a menu with submenus to my MFC frame program. I also have a child view window instantiated within a main frame.

In the child window i can successfully do a MouseRight click and popup of some menu with its submenus from the main menu bar.

However, when i want to disable some submenu I cannot do it.

I already have the following functions:

bool CMViewOption1Enabled;
.
.
.
.
.

	ON_COMMAND(CM_VIEW_OPTION1, CmViewOption1)
	ON_COMMAND(CM_VIEW_OPTION2, CmViewOption2)
	ON_UPDATE_COMMAND_UI(CM_VIEW_OPTION1, CmEnableViewOption1)
.
.
.
.
.
.
.
/***************************************************************/
/*                                                             */
/* ViewOption1:          */
/*                                                             */
/***************************************************************/

void ChildView::CmViewOption1()
{
	MessageBox("View Option1", "MENU", MB_OK | MB_ICONEXCLAMATION);
	CMViewOption1Enabled = false;
	
}

/***************************************************************/
/*                                                             */
/* CmEnableViewOption1:          */
/*                                                             */
/***************************************************************/

void ChildView::CmEnableViewOption1(CCmdUI *ptrenabler)
{
	ptrenabler->Enable(CMViewOption1Enabled);
	//ptrenabler->DoUpdate(this, TRUE);
	
}

/***************************************************************/
/*                                                             */
/* ViewOption2:          */
/*                                                             */
/***************************************************************/

void ChildView::CmViewOption2()
{
	MessageBox("View Option2", "MENU", MB_OK | MB_ICONEXCLAMATION);
}


So, i right click inside my child view i see Option1, Option2, and when i click on either i can see message window popping up, meaning that they work.

However, if you noticed, when i click Option 1, it must disable this same option in menu (it must be grayed out) but that does not happen.

What is the proper way to get it to work?

to give additonal details, when i right click and select Option 1, i do see message about it, and as i mentioned above I do not see it grayed out, however when i click it again, no message appears, which means (i assume) that menu is already disabled, but not grayed out..so how to permanently disable/gray it out?

modified 11-Jan-16 10:44am.

AnswerRe: MFC, Cannot disable Menu option from Child View Pin
Richard MacCutchan11-Jan-16 5:59
mveRichard MacCutchan11-Jan-16 5:59 
GeneralRe: MFC, Cannot disable Menu option from Child View Pin
Member 1120327711-Jan-16 7:23
MemberMember 1120327711-Jan-16 7:23 
GeneralRe: MFC, Cannot disable Menu option from Child View Pin
Richard MacCutchan11-Jan-16 21:23
mveRichard MacCutchan11-Jan-16 21:23 
AnswerRe: MFC, Cannot disable Menu option from Child View Pin
Jochen Arndt11-Jan-16 21:30
professionalJochen Arndt11-Jan-16 21:30 
GeneralRe: MFC, Cannot disable Menu option from Child View Pin
Member 1120327712-Jan-16 3:51
MemberMember 1120327712-Jan-16 3:51 
QuestionHow to change a alignment of CStatic Label at run time? Pin
Le@rner9-Jan-16 1:52
MemberLe@rner9-Jan-16 1:52 
AnswerRe: How to change a alignment of CStatic Label at run time? Pin
Richard MacCutchan9-Jan-16 2:46
mveRichard MacCutchan9-Jan-16 2:46 
GeneralRe: How to change a alignment of CStatic Label at run time? Pin
Le@rner10-Jan-16 18:29
MemberLe@rner10-Jan-16 18:29 
QuestionRe: How to change a alignment of CStatic Label at run time? Pin
Richard MacCutchan10-Jan-16 20:56
mveRichard MacCutchan10-Jan-16 20:56 
AnswerRe: How to change a alignment of CStatic Label at run time? Pin
Le@rner12-Jan-16 18:23
MemberLe@rner12-Jan-16 18:23 
GeneralRe: How to change a alignment of CStatic Label at run time? Pin
Richard MacCutchan12-Jan-16 21:20
mveRichard MacCutchan12-Jan-16 21:20 
QuestionHow to determine whether the disk is bitlocker? Pin
AnsiliWork8-Jan-16 19:29
MemberAnsiliWork8-Jan-16 19:29 
AnswerRe: How to determine whether the disk is bitlocker? Pin
Richard MacCutchan8-Jan-16 22:51
mveRichard MacCutchan8-Jan-16 22:51 
QuestionObject Data lost when dialog is moved 'off screen Pin
Member 122530108-Jan-16 12:24
MemberMember 122530108-Jan-16 12:24 
AnswerRe: Object Data lost when dialog is moved 'off screen Pin
Richard Andrew x648-Jan-16 15:34
professionalRichard Andrew x648-Jan-16 15:34 
GeneralRe: Object Data lost when dialog is moved 'off screen Pin
Member 1225301011-Jan-16 5:45
MemberMember 1225301011-Jan-16 5:45 
QuestionHow to analyze what time Windows 7(XP) once run any program? Pin
AnsiliWork7-Jan-16 14:55
MemberAnsiliWork7-Jan-16 14:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.