Click here to Skip to main content
15,888,733 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: check/ uncheck menu item in a pop up menu Pin
Nibu babu thomas31-Mar-08 22:54
Nibu babu thomas31-Mar-08 22:54 
GeneralRe: check/ uncheck menu item in a pop up menu Pin
kutti31-Mar-08 23:02
kutti31-Mar-08 23:02 
GeneralRe: check/ uncheck menu item in a pop up menu Pin
Nibu babu thomas31-Mar-08 23:14
Nibu babu thomas31-Mar-08 23:14 
GeneralRe: check/ uncheck menu item in a pop up menu Pin
Saurabh.Garg31-Mar-08 21:33
Saurabh.Garg31-Mar-08 21:33 
GeneralRe: check/ uncheck menu item in a pop up menu Pin
kutti31-Mar-08 21:35
kutti31-Mar-08 21:35 
GeneralRe: check/ uncheck menu item in a pop up menu Pin
Saurabh.Garg31-Mar-08 22:48
Saurabh.Garg31-Mar-08 22:48 
GeneralRe: check/ uncheck menu item in a pop up menu Pin
kutti31-Mar-08 22:54
kutti31-Mar-08 22:54 
GeneralRe: check/ uncheck menu item in a pop up menu Pin
Saurabh.Garg31-Mar-08 23:23
Saurabh.Garg31-Mar-08 23:23 
Okay I just tried a sample in VS 2008 and this method works.

1. Create an dialog application.
2. Added a tree control
3. Added a menu with 2 items.
4. Added handler for NM_RCLICK for tree control.
5. Added Command and CommandUI event handlers for 3 items in the menu.

Now when an item is selected in the menu there is no check box.

6. Added ON_WM_INITMENUPOPUP handler for the Dialog class.
7. Added the code I posted in previous message.

Now when an item is selected in the menu and the menu us shown again next time there is check against it.

Let's say there is a variable int x in the dialog and it x=1 then it mean first item is selected and if x=2 then second item is selected. The following is the code for command and commandui handlers.


void CTestDlg::OnButton1()
{
	x = 0;
}

void CTestDlg::OnUpdateButton1(CCmdUI *pCmdUI)
{
	if(x == 0)
	{
		pCmdUI->SetCheck(1);
	}
	else
	{
		pCmdUI->SetCheck(0);
	}
}

void CTestDlg::OnButton2()
{
	x = 1;
}

void CTestDlg::OnUpdateButton2(CCmdUI *pCmdUI)
{
	if(x == 1)
	{
		pCmdUI->SetCheck(1);
	}
	else
	{
		pCmdUI->SetCheck(0);
	}
}

GeneralRe: check/ uncheck menu item in a pop up menu Pin
kutti1-Apr-08 2:25
kutti1-Apr-08 2:25 
GeneralRe: check/ uncheck menu item in a pop up menu Pin
Saurabh.Garg1-Apr-08 4:07
Saurabh.Garg1-Apr-08 4:07 
GeneralRe: check/ uncheck menu item in a pop up menu Pin
kutti8-Apr-08 1:48
kutti8-Apr-08 1:48 
QuestionRe: check/ uncheck menu item in a pop up menu Pin
David Crow1-Apr-08 3:41
David Crow1-Apr-08 3:41 
GeneralRe: check/ uncheck menu item in a pop up menu Pin
Hamid_RT7-Apr-08 2:57
Hamid_RT7-Apr-08 2:57 
GeneralRe: check/ uncheck menu item in a pop up menu Pin
kutti7-Apr-08 18:12
kutti7-Apr-08 18:12 
GeneralConnecting SQL Server DB in C++/VC++ Pin
Sgg24531-Mar-08 19:58
Sgg24531-Mar-08 19:58 
QuestionRe: Connecting SQL Server DB in C++/VC++ Pin
CPallini31-Mar-08 21:47
mveCPallini31-Mar-08 21:47 
QuestionRe: Connecting SQL Server DB in C++/VC++ Pin
David Crow1-Apr-08 3:43
David Crow1-Apr-08 3:43 
GeneralRe: Connecting SQL Server DB in C++/VC++ Pin
Hamid_RT7-Apr-08 2:56
Hamid_RT7-Apr-08 2:56 
Questionclosing and reopening exploere.exe using win32 or anyother language Pin
Jach Mullan31-Mar-08 19:53
Jach Mullan31-Mar-08 19:53 
GeneralRe: closing and reopening exploere.exe using win32 or anyother language Pin
Nibu babu thomas31-Mar-08 20:48
Nibu babu thomas31-Mar-08 20:48 
Questionhiding the taskbar icons using win32 Pin
Jach Mullan31-Mar-08 19:50
Jach Mullan31-Mar-08 19:50 
GeneralRe: hiding the taskbar icons using win32 [modified] Pin
Nibu babu thomas31-Mar-08 21:34
Nibu babu thomas31-Mar-08 21:34 
QuestionPossible to load swf in resource? Pin
manish.patel31-Mar-08 19:32
manish.patel31-Mar-08 19:32 
GeneralRe: Possible to load swf in resource? Pin
Mark Salsbery1-Apr-08 6:55
Mark Salsbery1-Apr-08 6:55 
GeneralRe: Possible to load swf in resource? Pin
manish.patel1-Apr-08 18:17
manish.patel1-Apr-08 18:17 

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.