[vtkusers] Exploiting MFC's Document View magic (Was: VTK Help!)

Nigel Nunn nNunn at ausport.gov.au
Tue Feb 26 12:17:12 EST 2002


Hi mirko, 
 
> i'm wondering if i can make changes that affect my Renderer, 
> like change camera position, from the Document side of a 
> MFC Application (i need to these from the OnSaveDocument 
> function) and if yes how :) 

Yes.  The document owns its view(s), and the idea is for the 
document to manipulate its views to display information about 
its current state.  To make this work, you need to read about 
how a document communicates with its list of views, and how, 
for example, it can iterate though this list, and how it can 
Update All its Views via: 
 
  MyDoc::UpdateAllViews(NULL); 
 
Each of your CView-derived Vtk windows will respond to this 
command (from its owner/document) by calling its OnUpdate(). 
 
>From the VC Help: 
------------------------------------------- 
 
void CMyDoc::OnRepaintAllViews() 
{ 
  POSITION pos = GetFirstViewPosition(); 
  while (pos != NULL) 
  { 
    CView* pView = GetNextView(pos); 
    pView->UpdateWindow(); 
  } 
} 

Easier way  -->  UpdateAllViews(NULL); 

Nigel



More information about the vtkusers mailing list