[wxVTK] Resizing problem under wxMSW
Brought to you by:
malat
From: John N. <jn...@mc...> - 2005-03-15 20:23:49
|
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 -- John Norris Research Programmer Center for Simulation of Advanced Rockets http://www.uiuc.edu/ph/www/jnorris |