Click here to Skip to main content
15,916,280 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionEnable/Disable menu items programmatically Pin
john john mackey24-Apr-09 8:18
john john mackey24-Apr-09 8:18 
AnswerRe: Enable/Disable menu items programmatically Pin
David Crow24-Apr-09 8:36
David Crow24-Apr-09 8:36 
GeneralRe: Enable/Disable menu items programmatically Pin
john john mackey24-Apr-09 10:29
john john mackey24-Apr-09 10:29 
QuestionRe: Enable/Disable menu items programmatically Pin
David Crow24-Apr-09 10:32
David Crow24-Apr-09 10:32 
AnswerRe: Enable/Disable menu items programmatically Pin
john john mackey24-Apr-09 10:42
john john mackey24-Apr-09 10:42 
QuestionRe: Enable/Disable menu items programmatically Pin
David Crow24-Apr-09 10:46
David Crow24-Apr-09 10:46 
AnswerRe: Enable/Disable menu items programmatically Pin
john john mackey24-Apr-09 11:26
john john mackey24-Apr-09 11:26 
AnswerRe: Enable/Disable menu items programmatically Pin
john john mackey27-Apr-09 11:22
john john mackey27-Apr-09 11:22 
sorry for the same problem again, but I have one more question regarding this:

Is there a difference in how menu items are handle in Doc/View applications Vs. a Dialog-based app?

The previous example, which worked, was implemented in a Doc/View application. The ON_UPDATED_COMMAND_UI was placed in the view.cpp section of code. here is what worked:
(PrevProgramView.cpp)
BEGIN_MESSAGE_MAP(CPrevProgramView, CView)
//{{AFX_MSG_MAP(CPrevProgramView)
     ON_COMMAND(ID_FILE_ADJUST, OnFileAdjustTimes)
     ON_UPDATE_COMMAND_UI(ID_FILE_ADJUST, OnUpdateFileAdjustTimes)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()


then the function
void CPrevProgramView::OnUpdateFileAdjustTimes(CCmdUI *pCmdUI)
{
     if (m_existingFile)
          pCmdUI->Enable(TRUE);
     else
          pCmdUI->Enable(FALSE);
}

and my resource property for ID_FILE_ADJUST is set to: Enabled=False, Greyed=True


In the new piece of code I'm trying to write (Dialog-based app), I have the following:
BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
	//{{AFX_MSG_MAP(CMyDlg)
	ON_COMMAND(ID_UTILITIES_CONVERT, OnUtilitiesConvert)
	ON_UPDATE_COMMAND_UI(ID_UTILITIES_CONVERT, &CMyDlg::OnUpdateUtilitiesConvert)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

and the new function (that IS called) is 
void CMyDlg::OnUpdateUtilitiesConvert(CCmdUI *pCmdUI)
{
	CFileStatus	cfStat;
	CString		sProcName;
	BOOL		bExists = FALSE;

	sProcName.LoadStringA(IDS_COORD_CONV);

	// Get the status of this file - exists or not
	bExists = CFile::GetStatus(sProcName, cfStat);
	pCmdUI->Enable( bExists );
}
with my resource ID_UTILITIES_CONVERT set to Enabled=False, Greyed=True.


NOTE: I even changed my ID_UTILITIES_CONVERT to Enabled=TRUE, Greyed=FALSE, changed pCmdUI->Enable( FALSE ); and set breakpoints - did not change the menu item to disabled

Don't know what is not working Confused | :confused:
GeneralRe: Enable/Disable menu items programmatically Pin
David Crow28-Apr-09 3:04
David Crow28-Apr-09 3:04 
QuestionGetting clipboard paste notification. Pin
Green Fuze24-Apr-09 4:47
Green Fuze24-Apr-09 4:47 
AnswerRe: Getting clipboard paste notification. Pin
led mike24-Apr-09 5:16
led mike24-Apr-09 5:16 
GeneralRe: Getting clipboard paste notification. Pin
CPallini24-Apr-09 5:42
mveCPallini24-Apr-09 5:42 
GeneralRe: Getting clipboard paste notification. Pin
Green Fuze24-Apr-09 10:53
Green Fuze24-Apr-09 10:53 
GeneralRe: Getting clipboard paste notification. Pin
Green Fuze24-Apr-09 10:52
Green Fuze24-Apr-09 10:52 
QuestionRe: Getting clipboard paste notification. Pin
David Crow24-Apr-09 6:04
David Crow24-Apr-09 6:04 
AnswerRe: Getting clipboard paste notification. Pin
Green Fuze24-Apr-09 10:58
Green Fuze24-Apr-09 10:58 
AnswerRe: Getting clipboard paste notification. Pin
wguerram2-Apr-10 5:27
wguerram2-Apr-10 5:27 
QuestionIs there any way to display info for password is strong or not like in MBSA show Pin
ashish8patil24-Apr-09 2:49
ashish8patil24-Apr-09 2:49 
AnswerRe: Is there any way to display info for password is strong or not like in MBSA show Pin
Stuart Dootson24-Apr-09 3:46
professionalStuart Dootson24-Apr-09 3:46 
AnswerRe: Is there any way to display info for password is strong or not like in MBSA show Pin
David Crow24-Apr-09 4:06
David Crow24-Apr-09 4:06 
QuestionHow to List firewall rules in VC++ in XP not in vista Pin
ashish8patil24-Apr-09 2:46
ashish8patil24-Apr-09 2:46 
AnswerRe: How to List firewall rules in VC++ in XP not in vista Pin
Stuart Dootson24-Apr-09 3:36
professionalStuart Dootson24-Apr-09 3:36 
GeneralRe: How to List firewall rules in VC++ in XP not in vista Pin
ashish8patil25-Apr-09 3:15
ashish8patil25-Apr-09 3:15 
GeneralRe: How to List firewall rules in VC++ in XP not in vista Pin
Stuart Dootson25-Apr-09 3:27
professionalStuart Dootson25-Apr-09 3:27 
GeneralHow to List firewall rules in VC++ in XP not in vista Pin
ashish8patil27-Apr-09 18:52
ashish8patil27-Apr-09 18:52 

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.