Click here to Skip to main content
15,922,650 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: plz Tell me Pin
_AnsHUMAN_ 3-Jul-06 0:05
_AnsHUMAN_ 3-Jul-06 0:05 
GeneralRe: plz Tell me Pin
Abhi Lahare3-Jul-06 0:12
Abhi Lahare3-Jul-06 0:12 
QuestionListbox Scrollbar issue Pin
Sarath C2-Jul-06 23:32
Sarath C2-Jul-06 23:32 
QuestionChanging Active View Pin
_Tom_2-Jul-06 23:27
_Tom_2-Jul-06 23:27 
AnswerRe: Changing Active View Pin
Viorel.2-Jul-06 23:38
Viorel.2-Jul-06 23:38 
GeneralRe: Changing Active View Pin
_Tom_3-Jul-06 0:59
_Tom_3-Jul-06 0:59 
GeneralRe: Changing Active View Pin
Viorel.3-Jul-06 1:26
Viorel.3-Jul-06 1:26 
AnswerRe: Changing Active View [modified] Pin
Cliff Hatch3-Jul-06 11:36
Cliff Hatch3-Jul-06 11:36 
I wrote the following procedure to activate views programatically. It's a bit specialised, but I hope it might give you some useful clues. The bit underneath the comment "//There is already a View displaying this parent..." activates the view pointed to by pView.

CKernelView* CMainFrame::ActivateView(CModel* pParentModel)
{
	//Activate new or existing view containing pParentModel

	CKernelView *pView, *pActiveView;
	CWnd* pBar;
	CMDIFrameWnd *pFrame;
	CMDIChildWnd *pChild;

	pBar = GetDlgItem(IDD_NAVIGATOR_BAR);

	//Get a pointer to the active view (there are three stages to this)
	pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;		//Get a pointer to the active MDI window
	pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();		//Get the active MDI child window.
	pActiveView = (CKernelView*)pChild->GetActiveView();	//Get the View attached to the active MDI child window

	if (pActiveView->m_pParentModel == pParentModel)
		pView = pActiveView;	//The required parent model is already in the active view
	else if (pParentModel->m_pShadow != NULL)
	{
		//There is already a View displaying this parent, activate its frame
		pView = pParentModel->m_pShadow->m_pView;
		pFrame = (CMDIFrameWnd*)pView->GetParentFrame();
		pFrame->ActivateFrame(SW_RESTORE);
	}
	else if (pBar->IsDlgButtonChecked(IDC_TRACK_NEW))
		pView = pParentModel->OpenView(m_pDocViewed, pParentModel->m_PlantFlag);	//Open new window
	else
	{
		//Reuse current window
		pView = pActiveView;
		pView->ChangeModel(pParentModel);	
	}

	return pView;
}


Best Regards

Cliff

-- modified at 17:36 Monday 3rd July, 2006
QuestionUrgent :- How to read the unicode file with C/C++ Pin
Rocky Marrone2-Jul-06 23:26
Rocky Marrone2-Jul-06 23:26 
AnswerRe: Urgent :- How to read the unicode file with C/C++ Pin
Justin Tay3-Jul-06 2:08
Justin Tay3-Jul-06 2:08 
GeneralRe: Urgent :- How to read the unicode file with C/C++ Pin
Rocky Marrone3-Jul-06 2:51
Rocky Marrone3-Jul-06 2:51 
GeneralRe: Urgent :- How to read the unicode file with C/C++ Pin
Justin Tay3-Jul-06 2:56
Justin Tay3-Jul-06 2:56 
Questionhow to enumerate domain name list? Pin
host282-Jul-06 23:23
host282-Jul-06 23:23 
QuestionC++ Pin
Nirmal Khatri2-Jul-06 23:02
Nirmal Khatri2-Jul-06 23:02 
AnswerRe: C++ Pin
Cedric Moonen2-Jul-06 23:05
Cedric Moonen2-Jul-06 23:05 
QuestionAdding a toolbar in Win32 Application Pin
Cyber Friend2-Jul-06 22:56
Cyber Friend2-Jul-06 22:56 
Questionproblem on resize window???? Pin
mimimimilaw2-Jul-06 22:55
mimimimilaw2-Jul-06 22:55 
QuestionRe: problem on resize window???? Pin
see me2-Jul-06 23:19
see me2-Jul-06 23:19 
AnswerRe: problem on resize window???? Pin
mimimimilaw2-Jul-06 23:29
mimimimilaw2-Jul-06 23:29 
GeneralRe: problem on resize window???? Pin
see me2-Jul-06 23:35
see me2-Jul-06 23:35 
QuestionHow to validate data in property sheet. Pin
jadhav1232-Jul-06 22:53
jadhav1232-Jul-06 22:53 
AnswerRe: How to validate data in property sheet. Pin
Viorel.2-Jul-06 23:15
Viorel.2-Jul-06 23:15 
GeneralRe: How to validate data in property sheet. Pin
jadhav1236-Jul-06 23:25
jadhav1236-Jul-06 23:25 
AnswerRe: How to validate data in property sheet. Pin
Rudolf Jan3-Jul-06 0:55
Rudolf Jan3-Jul-06 0:55 
QuestionVector Problem [modified] Pin
CornToeGoblin2-Jul-06 22:51
CornToeGoblin2-Jul-06 22:51 

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.