[vtkusers] help with renderwindow just a part of MFC window

John Platt jcplatt at lineone.net
Tue Aug 23 19:24:47 EDT 2005


Hi Isabelle,

 

I haven’t used CFormView but I assume you have defined a control on your
dialog template (IDC_RECT?) in which to draw the vtk images. I would
have thought that the vtk render window wants the handle to this control
rather than the CFormView derived class, something like

 

CWnd* pWnd = GetDlgItem(IDC_RECT);

HWND hWnd = pWnd->GetSafeHwnd();

myRenderWindow ->SetParentId( hWnd );

 

Only a guess.

 

John.

 

 

-----Original Message-----
From: vtkusers-bounces+jcplatt=lineone.net at vtk.org
[mailto:vtkusers-bounces+jcplatt=lineone.net at vtk.org] On Behalf Of
Renaud Isabelle
Sent: 23 August 2005 19:05
To: insight-users at itk.org; vtkusers at public.kitware.com
Subject: [vtkusers] help with renderwindow just a part of MFC window

 

Hi, 

 

I got some problems with handling interaction between MFC interface and
vtkRenderWindow.

 

The main problem that I have, lies in the fact that my render window is
just a small part of my MFC window (CView). Indeed, when left button
mouse is pressed in the MFC window, my function
renderWindow->SelectPoint() is called only when clicked point is not in
the render window. I checked out if my interactor size was set to
correct dimensions and it is actually the case. But I can't figure out
why my function is called only when I clicked outside the render window.


 

- Maybe the origin of the problem is that I am missing something with
SetParentId, SetWindowId and so on... 

 

Most of the examples that I read deal with a vtkRenderWindow's size the
same than CView's size: in this case,
myRenderWindow->SetParentId(this->h_Wnd) seems to fit exactly. 

 

 

Here is what I did: 

 

 // setup the parent window
 myRenderWindow->SetParentId(this->m_hWnd);
 myRenderWindow->WindowInitialize();

 

 CRect rect;
 GetDlgItem(IDC_RECT)->GetWindowRect(rect);
myRenderWindow->SetPosition(rect.left,rect.top);
myRenderWindow->SetSize(rect.Width(),rect.Height());

 

- Now, I saw an example where: 

 

HWND hWndRenderer = ::CreateWindowEx(WS_EX_CLIENTEDGE, OCT3DRENDERCLASS,
NULL, WS_CHILD|WS_VISIBLE|WS_TABSTOP, 7, 7, nWidth, nHeight, m_hWnd,
NULL, AfxGetInstanceHandle(), NULL);

 

 myRenderWindow->SetParentId(hWndRenderer);

 

Does someone try this kind of thing? Do you think this could be the
solution? Or maybe someone has examples where, like me, the render
window is just a part of a MFC window.

 

- Or, maybe, my problem comes from somewhere else: timer,
interactor->Start()... because after a while everything works fine.

 

I hope someone can help me.....

 

Isabelle

 

  _____  

Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo!
Messenger
Téléchargez
<http://us.rd.yahoo.com/messenger/mail_taglines/default/*http:/fr.messen
ger.yahoo.com>  le ici ! 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050824/07c0e58f/attachment.htm>


More information about the vtkusers mailing list