Re: [wxVTK] Resizing problem under wxMSW
Brought to you by:
malat
From: Mathieu M. <mma...@ny...> - 2005-03-22 02:31:14
|
John, Thanks a lot for your patch. I just patched wxVTK with your proposed changed.: $ cvs ci -m"BUG: Fix resize problem. Thanks to patch from John Norris" wxVTKRenderWindowInteractor.cxx Checking in wxVTKRenderWindowInteractor.cxx; /cvsroot/wxvtk/wxVTK/src/wxVTKRenderWindowInteractor.cxx,v <-- wxVTKRenderWindowInteractor.cxx new revision: 1.17; previous revision: 1.16 done I'll try to release wxVTK 0.8 ASAP. Mathieu John Norris wrote: > Hi, > > I ran into a highly frustrating problem when using > wxVTKRenderWindowInteractor as a child window in wxMSW. Specifically, I > have a wxFrame with a few wxSashLayoutWindows, and I'm using the wxVTK > window as the "filler" window in wxLayoutAlgorithm::LayoutFrame(). > > When the frame first poped up, everything would look fine. But when I > resized the window or dragged a sash, the wxVTKRenderWindowInteractor > would mysteriously get too big for its alloted space. > > After much investigation I discovered that when its ParentId is not set, > vtkWin32OpenGLRenderWindow automatically increases its size to make room > for the title bar and window borders. In my case at least, this is > undesirable behavior. > > The solution is for wxVTKRenderWindowInteractor to set its render > window's ParentId as well as its WindowId. In > wxVTKRenderWindowInteractor::OnPaint(), I changed > > if(!Handle) > { > Handle = GetHandle(); > RenderWindow->SetWindowId(reinterpret_cast<void *>(Handle)); > } > > to > > if(!Handle) > { > Handle = GetHandle(); > RenderWindow->SetWindowId(reinterpret_cast<void *>(Handle)); > #ifdef __WXMSW__ > RenderWindow->SetParentId(reinterpret_cast<void > *>(this->GetParent()->GetHWND())); > #endif //__WXMSW__ > } > > I made the call to SetParentId() wxMSW-specific, since wxGTK et al seem > to work just fine, and I didn't want to break them. > > Thanks, > John |