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

Renaud Isabelle renauisa at yahoo.fr
Thu Aug 25 09:54:52 EDT 2005


Hi,
 
I tried what to advice me, and now, no problem anymore concerning clicking in my render window. I am so happy, thanks a lot. 
 
CWnd* pWnd = GetDlgItem(IDC_RECT);
myRenderWindow ->SetParentId(this->m_hWnd);
myRenderWindow ->SetWindowId(pWnd->GetSafeHwnd());
myRenderWindow ->WindowInitialize();
 pWnd->ShowWindow(SW_SHOW);
 
- However, there is still something annoying: 
        now that my renderwindow is associated with the MFC window (CWnd* pWnd), the only way to make it appear, is to set the MFC window visible (ShowWindow(SW_SHOW)). But, by doing this, the MFC window itself is also visible and every paint called, I have to click on the render window that I can't see to make it appear. So strange! what I would like to have is a render window visible but not the rectangle that contains it. 
 
Any idea?!
 
Isabelle


John Platt <jcplatt at lineone.net> a écrit :

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 le ici ! 


		
---------------------------------
 Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger
 Téléchargez le ici !  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050825/4181322e/attachment.htm>


More information about the vtkusers mailing list