Click here to Skip to main content
15,918,268 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralAbout Progress Control (MFC) Pin
jcpooh5-Jun-03 15:20
jcpooh5-Jun-03 15:20 
GeneralRe: About Progress Control (MFC) Pin
FlyingDancer5-Jun-03 15:55
FlyingDancer5-Jun-03 15:55 
GeneralRe: About Progress Control (MFC) Pin
jcpooh5-Jun-03 16:00
jcpooh5-Jun-03 16:00 
GeneralRe: About Progress Control (MFC) Pin
FlyingDancer5-Jun-03 16:37
FlyingDancer5-Jun-03 16:37 
GeneralRe: About Progress Control (MFC) Pin
jcpooh5-Jun-03 16:58
jcpooh5-Jun-03 16:58 
GeneralRe: About Progress Control (MFC) Pin
FlyingDancer5-Jun-03 17:22
FlyingDancer5-Jun-03 17:22 
GeneralRe: About Progress Control (MFC) Pin
jcpooh5-Jun-03 18:26
jcpooh5-Jun-03 18:26 
GeneralSubmenu MF_GREYOUT and MF_ENABLE Pin
adonisv5-Jun-03 11:55
adonisv5-Jun-03 11:55 
Does anyone have any idea why EnableMenuItem in case seven is being totally ignored? I get a beep when I put one there. The code is being reached but calls to it are returning zero and nothing is happening. All the menu selections appear enabled and won't grey out no matter what I do. GetMenuItemID is actually getting a value. I'm a bit lost on this....Cry | :((


void CSacmanSetupApplicationView::OnRclickSetupTree(NMHDR* pNMHDR, LRESULT* pResult) <br />
{<br />
	// TODO: Add your control notification handler code here<br />
	// Declare and initialize local variables<br />
	int x=0,y=0,index = 0;<br />
<br />
	CString itemText;<br />
<br />
	DWORD mousePosition;<br />
	DWORD itemData;<br />
<br />
	<br />
	// Get the current position of the mouse.<br />
	// Mouseposition will contain the x and y coordinates.<br />
	mousePosition = ::GetMessagePos();<br />
<br />
	// Use the get x and y macros to extract the x<br />
	// and y coordinates of the mouse position.<br />
	x = GET_X_LPARAM(mousePosition);<br />
	y = GET_Y_LPARAM(mousePosition);<br />
<br />
<br />
	// Create a menu object and a menu pointer. NewMenu will be the<br />
	// "backdrop" menu that the other popup menus are added to.<br />
	// Submenu will be used to access the inserted submenus.<br />
	CMenu newMenu;<br />
	CMenu *submenu;<br />
	CGate* pGate = NULL;<br />
	<br />
	// Get the currently selected item in the tree so you know which<br />
	// pop up menus to show to the user.<br />
	itemData = this->m_ctrlSetupTree.GetItemData(this->m_ctrlSetupTree.GetSelectedItem());<br />
	this->SetSelectedTreeItem(this->m_ctrlSetupTree.GetSelectedItem());<br />
<br />
	itemText = this->m_ctrlSetupTree.GetItemText(this->m_tiSelectedItem);<br />
	<br />
	// Only create the popup menu if the user clicks on an item <br />
	// in the tree that has been designated a having a menu associated <br />
	// with it.<br />
	switch(itemData)<br />
	{<br />
			<br />
	case 7:<br />
<br />
		// Load the main menu.<br />
		newMenu.LoadMenu(IDR_SYSTEM_MENU);<br />
		// Get the "edit gate" pop-up menu.<br />
		submenu = newMenu.GetSubMenu(7);<br />
<br />
		// Attempt to find the selected gate in the CanalManager<br />
		pGate =this->m_oCanalManager.GetGate(itemText);<br />
<br />
		// Once the gate is found, check its type.<br />
		if(pGate)<br />
		{<br />
			<br />
			// Based on the type of the gate, enable and disable<br />
			// the relevant menu selections.<br />
			if(pGate->IsPiped())<br />
			{<br />
				Beep(444,44);<br />
				 <br />
				submenu->EnableMenuItem(submenu->GetMenuItemID(0),MF_BYPOSITION||MF_GRAYED);<br />
				submenu->EnableMenuItem(submenu->GetMenuItemID(1),MF_BYPOSITION||MF_GRAYED);<br />
				submenu->EnableMenuItem(submenu->GetMenuItemID(2),MF_BYPOSITION||MF_GRAYED);<br />
			}<br />
			else if(pGate->IsRectangular())<br />
			{<br />
				<br />
				submenu->EnableMenuItem(submenu->GetMenuItemID(0),MF_BYCOMMAND||MF_ENABLED);<br />
				submenu->EnableMenuItem(submenu->GetMenuItemID(1),MF_BYCOMMAND||MF_ENABLED);<br />
				submenu->EnableMenuItem(submenu->GetMenuItemID(2),MF_BYCOMMAND||MF_ENABLED);<br />
				<br />
			}<br />
		}<br />
<br />
		// Post the menu.<br />
		submenu->TrackPopupMenu(TPM_CENTERALIGN,x,y,::AfxGetMainWnd(),NULL);<br />
			<br />
		break;<br />
<br />
		case 8:<br />
<br />
		// Load the main menu.<br />
		newMenu.LoadMenu(IDR_SYSTEM_MENU);<br />
		// Get the "edit well" pop-up menu.<br />
		submenu = newMenu.GetSubMenu(5);	<br />
		// Post the menu.<br />
		submenu->TrackPopupMenu(TPM_CENTERALIGN,x,y,::AfxGetMainWnd(),NULL);	<br />
		break;<br />
<br />
		case 9:<br />
	<br />
		//Load the main menu.<br />
		newMenu.LoadMenu(IDR_SYSTEM_MENU);<br />
		// Get the "edit SSFC" pop-up menu.<br />
		submenu = newMenu.GetSubMenu(8);	<br />
		// Post the menu.<br />
		submenu->TrackPopupMenu(TPM_CENTERALIGN,x,y,::AfxGetMainWnd(),NULL);<br />
			<br />
		break;<br />
<br />
	default:<br />
		Beep(999,99);<br />
		break;<br />
		<br />
    }<br />
	<br />
	*pResult = 0;<br />
}


What's up with that???Confused | :confused:
GeneralRe: Submenu MF_GREYOUT and MF_ENABLE Pin
Michael Dunn5-Jun-03 15:01
sitebuilderMichael Dunn5-Jun-03 15:01 
GeneralRe: Submenu MF_GREYOUT and MF_ENABLE Pin
Toni785-Jun-03 21:34
Toni785-Jun-03 21:34 
GeneralUpdating Cut, Copy, Paste on toolbar Pin
Steven M Hunt5-Jun-03 10:53
Steven M Hunt5-Jun-03 10:53 
GeneralRe: Updating Cut, Copy, Paste on toolbar Pin
valikac5-Jun-03 12:56
valikac5-Jun-03 12:56 
GeneralC++ code for derivation and integration Pin
zakimurtaza5-Jun-03 9:14
zakimurtaza5-Jun-03 9:14 
GeneralRe: C++ code for derivation and integration Pin
Andrew Walker5-Jun-03 22:22
Andrew Walker5-Jun-03 22:22 
GeneralRemoving focus from button in dlg-based app Pin
Vikram A Punathambekar5-Jun-03 9:12
Vikram A Punathambekar5-Jun-03 9:12 
GeneralRe: Removing focus from button in dlg-based app Pin
valikac5-Jun-03 9:28
valikac5-Jun-03 9:28 
GeneralRe: Removing focus from button in dlg-based app Pin
Neville Franks5-Jun-03 10:55
Neville Franks5-Jun-03 10:55 
GeneralRe: Removing focus from button in dlg-based app Pin
Vikram A Punathambekar5-Jun-03 19:54
Vikram A Punathambekar5-Jun-03 19:54 
GeneralRe: Removing focus from button in dlg-based app Pin
BhaskarBora5-Jun-03 18:12
BhaskarBora5-Jun-03 18:12 
GeneralRe: Removing focus from button in dlg-based app Pin
Vikram A Punathambekar5-Jun-03 20:03
Vikram A Punathambekar5-Jun-03 20:03 
GeneralRe: Removing focus from button in dlg-based app Pin
BhaskarBora9-Jun-03 23:35
BhaskarBora9-Jun-03 23:35 
GeneralGood Window Apps - Help Pin
iltallman5-Jun-03 7:53
iltallman5-Jun-03 7:53 
GeneralRe: Good Window Apps - Help Pin
Daniel Turini5-Jun-03 8:37
Daniel Turini5-Jun-03 8:37 
GeneralRe: Good Window Apps - Help Pin
Neville Franks5-Jun-03 11:04
Neville Franks5-Jun-03 11:04 
GeneralTool Tips Not Displayed Pin
Dave_5-Jun-03 7:45
Dave_5-Jun-03 7:45 

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.