Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I'm Writing a dialog based program, and I replaced the original dialog by a propertysheet, the code show as below:

BOOL CInstrumentCtrlApp::InitInstance()
{
	TreePropSheet::CTreePropSheet dlg; //declare propertysheet
	CAgilent34401 ag34401;    //declare propertypage
	CTDS220 tds220;       //declare propertypage
	CWelcom welcom;    //declare propertypage

	dlg.AddPage(&welcom);
	dlg.AddPage(&tds220);
	dlg.AddPage(&ag34401);

	m_pMainWnd = &dlg;
	int nResponse = dlg.DoModal();
}


I want to dynamically change the propertysheet (like click a button to delete a page form sheet) after "DoModal()" was called, how to do it ?

regards,
Eloit
Posted
v2

1 solution

In your Button Event handler on the PropertyPage, just call the parent PropertySheet "RemovePage()" function, for example, "RemovePage(this)". Be careful that if you are removing the active page, which you most likely are, you should use the PropertySheet function "SetActivePage()" to have some other page become active, like your welcome page.

I also use the CTreePropSheet class, or one of its derivations, and I remember that there was some issue with deleting pages and having the tree redrawn properly. I would test this with the standard CPropertySheet first, watching the tabs appear and disappear properly first, then move back to the CTreePropSheet class.
 
Share this answer
 
Comments
eaoiyrioeaf 19-Jun-11 6:01am    
appreciate you help very much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900