I am developing a small MFC program, and I'm obsessed with good programming practices.
I would like to know how to manage messages between windows in SDI application in the right way on a document / view architecture.
Below I will outline practical case in which I have encountered a problem. The following image is a screenshot of my SDI application generated with visual studio wizard.

Name:  Captura.jpg
Views: 416
Size:  65.3 KB

The three main classes generated by visual studio wizard are:

Code:
	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CCameraCalibrationDoc),
		RUNTIME_CLASS(CMainFrame),       // Ventana de marco SDI principal
		RUNTIME_CLASS(CCameraCalibrationView));
The window that I have numbered as one is a Class CCameraCalibrationView, and is easy to access the document linked to by the function GetDocument() and modify it in response to user interaction with the window.

Code:
class CCameraCalibrationView : public CView
{
protected: // Crear sólo a partir de serialización
	CCameraCalibrationView();
	DECLARE_DYNCREATE(CCameraCalibrationView)

// Atributos
public:
	CCameraCalibrationDoc* GetDocument() const;

// Operaciones
public:
...
So it is just as easy to call the function UpdateAllViews (CView * pSender, LPARAM lHint = 0L, CObject * pHint = NULL) after modifying the document to refresh the view CCameraCalibrationView class.

UpdateAllViews only modifies CView inherited classes that are part of the document template in the case of my application is CCameraCalibrationView (and on a SDI application I think I can only have one view linked to the document). The problem is that my CDockablePane controls (2 and 3 in the screenshot) that should be able to modify the document in response to the user and should be updated as CCameraCalibrationView to the modification of the document.

I dont know how to do it, respecting the document / view architecture and program it in an elegant way.

I can only think in generate custom windows messages from DockablePanes in respond to user inputs and send it to the CMainFrame, cath it from the MainFrame and change the document from here and redistribuite the message to all views including the CDockablePanes. it's rigth? it's smart?