I have a 2012 MSVC++ MFC MDI application which uses a PropertiesWnd.cpp file. It is generated by the wizard when I create the MFC application and ask for it.
It is a class CPropertiesToolBar : public CMFCToolBar. It uses a CMFCPropertyGridProperty
control to display propertys info of whatever I choose to define.
My question is…
How do I access CMFCPropertyGridProperty inside PropertiesWnd.cpp correctly to set the values of the CMFCPropertyGridProperty from another class in another file in scope ?
Example:
Would I do something like this …
// in my header use
CMainFrame * pMainWnd;
pMainWnd = (CMainFrame *)AfxGetMainWnd();
//Then where I want to do something
CString * myString;
myString->Append("My New Data");
DWORD_PTR dwData;
dwData = (DWORD_PTR)myString;
pMainWnd->m_wndProperties.pSelectedModelInfo->SetData(dwData);
// I’m doing this from a utility class member, I must update the properties
// based on the mouse selections of the user
Or should I use some kind of message mapping ?
What is the best/correct way to do this ? I’ve looked everywhere and can’t find an example of updating the CMFCPropertyGridProperty from another class.
Thanks,