[vtkusers] help
John Platt
jcplatt at lineone.net
Mon Aug 29 16:13:04 EDT 2005
Hi Isabelle,
Have you tried letting VTK create its own window in your control
something like
CWnd* pWnd = GetDlgItem(IDC_RECT);
HWND hWnd = pWnd->GetSafeHwnd();
myRenderWindow->SetParentId( hWnd );
// Change the size of the VTK window to match the client area.
CRect rect;
pWnd->GetClientRect( &rect );
myInteractor->UpdateSize( rect.right-rect.left, rect.bottom-rect.top );
and use its own WndProc() instead of your override? (you must remove
myInteractor->SetInstallMessageProc(false)).
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: 26 August 2005 15:42
To: John Platt
Cc: vtkusers at vtk.org
Subject: RE: [vtkusers] help
Hi,
I am still locked with problems of handling interaction between MFC
interface and vtkRenderWindow. The main problem is that my render window
is just a small part of my MFC window (CView).
To resume, I tried 2 possibilities:
-1-
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());
But in this case, clicks in the MFC window are fine but clicks in the
render window are not always correctly handled. I couldn't figure out
why mouse clicks are only handled when happening outside the render
window.
-2-
CWnd* pWnd = GetDlgItem(IDC_RECT);
myRenderWindow ->SetParentId(this->m_hWnd);
myRenderWindow ->SetWindowId(pWnd->GetSafeHwnd());
myRenderWindow ->WindowInitialize();
pWnd->ShowWindow(SW_SHOW);
This seems better but now, I got problems while repainting that I didn't
have with the 1st solution: my render window appears only when the CWnd
associated to it, is visible with
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.
- So, none of these solutions works fine. I don't know what else to
try. I checked out in the code and it seems that, to handle my paint
problem, maybe, I could set the Device context to the same than my
parent's with SetDisplayId. But I couldn't find examples that implement
SetDisplayId(). What is the use of this function? Could it be the
solution to my problem.
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/20050829/33b3c54c/attachment.htm>
More information about the vtkusers
mailing list