[vtkusers] Still a Bug in vtkWin32OpenGLRenderWindow ?? -> Solution

Patric Weis Patric.Weis at Mycrona.de
Wed Mar 3 04:52:30 EST 2004


Hi Ingo,

 > This only worked with setting the ParentID to
 > SetParentId(::GetParent(m_hWnd)) and the windowID to
 > SetWindowId(m_hWnd)

That's right!

 > which doesn't work anymore under VTK 4.4.0

That's strange. :(

Double clicking works for me with the following code changes
in vtkMDI (MS Windows 2k, VC++ 6.0, vtk 4.5.0):

1.
In CVtkMDIView::OnCreate() I exchanged line

   this->renWin->SetParentId(this->m_hWnd);

by

   this->renWin->SetParentId(this->GetParent()->GetSafeHwnd());
   this->renWin->SetWindowId(this->GetSafeHwnd());

So I got
...
int CVtkMDIView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
   if (CView::OnCreate(lpCreateStruct) == -1)
     return -1;

   this->renWin->AddRenderer(this->ren);
   // setup the parent window
   this->renWin->SetParentId(this->GetParent()->GetSafeHwnd());
   this->renWin->SetWindowId(this->GetSafeHwnd());
   this->iren->SetRenderWindow(this->renWin);

   return 0;
}
...


2.
Then I created CVtkMDIView::OnLButtonDblClk() by means of the class wizard.
For example:
...
void CVtkMDIView::OnLButtonDblClk(UINT nFlags, CPoint point)
{
   this->txtMapper->SetInput("Double clicked!");
   this->txtMapper->Modified();
   this->renWin->Render();

   CView::OnLButtonDblClk(nFlags, point);
}
...

That's all and it works for me even with the current nightly
without any crash at the end of the program.

Hope it helps! ;)

Patric Weis
MYCRONA


de Boer Ingo schrieb am 02.03.2004 17:44:

> The only thing is that I cannot handle a doubleclick.
> Because the event is not sent back to my View-class.
> This only worked with setting the ParentID to
> SetParentId(::GetParent(m_hWnd)) and the windowID to
> SetWindowId(m_hWnd) which doesn't work anymore under
> VTK 4.4.0
> 
> Maybe somebody has a comment on this ?
> 
> greets
>   Ingo
> 
> 
>>-----Original Message-----
>>From: de Boer Ingo 
>>Sent: Tuesday, March 02, 2004 4:39 PM
>>To: vtkusers
>>Cc: de Boer Ingo
>>Subject: [vtkusers] Still a Bug in vtkWin32OpenGLRenderWindow ?? ->
>>Solution
>>
>>
>>
>>Hi all,
>>
>>find attached some modifications for the MFC_MDI sample.
>>This is all based on VTK 4.4.0 release!
>>I guess, this is more conform and more clear. I also changed
>>the message handling. Therefore, I needed to change 3 lines
>>in vtkWin32RenderWindowInteractor.cxx. Maybe some off you should
>>check these changes with Borland, Cygwin, etc...
>>
>>Due to these changes, the OnSize(), OnEraseBkgnd() could be
>>deleted. The members are all deleted in OnDestroy() now.
>>Sizing, background and generell painting is done by VTK.
>>The pipeline is created once in OnInitialUpdate().
>>
>>If these changes go to the CVS, there should be some
>>changes made to MFC_SDI also! Maybe also the 'SampleMFC'
>>should be removed because the 'vtkMDI' and 'vtkSDI' sample
>>says it all ??
>>
>>greets
>>  Ingo
>>
>>---
>>Dr.-Ing. Ingo H. de Boer
>>
>>Polytec GmbH
>>Polytec-Platz 1-7, 76337 Waldbronn, Germany
>>phone: ++49 7243 604 106
>>fax  : ++49 7243 604 255
>>
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 



More information about the vtkusers mailing list