[vtkusers] to inherit a class

Amy Squillacote amy.squillacote at kitware.com
Wed Sep 14 13:23:24 EDT 2005


Hi Diego,

Did you include CvtkWin32OpenGLRenderWindow.h in 
your .cpp file?  (I'm guessing this is a subclass 
you created of vtkWin32OpenGLRenderWindow.)  Also 
vtkSetWindowLong is #define'd inside a few 
classes in VTK/Rendering, so you can't just use 
it; you would need to set the up the #define 
appropriately.  (See 
vtkWin32RenderWindowInteractor.cxx around line 50 for an example.)

- Amy

At 12:00 PM 9/14/2005, Diego Parada wrote:
>Hi,
>
>I have been treating to derivate a clas from 
>vtkWindowRenderInteractor but the compilation showws this:
>
>C:\test\ISVtest\MyvtkWin32RenderWindowInteractor.cpp(30) 
>: error C2065: 'CvtkWin32OpenGLRenderWindow' : undeclared identifier
>C:\test\ISVtest\MyvtkWin32RenderWindowInteractor.cpp(30) 
>: error C2065: 'tmp' : undeclared identifier
>C:\test\ISVtest\MyvtkWin32RenderWindowInteractor.cpp(30) 
>: warning C4552: '*' : operator has no effect; 
>expected operator with side-effect
>C:\test\ISVtest\MyvtkWin32RenderWindowInteractor.cpp(35) 
>: error C2065: 'vtkWin32OpenGLRenderWindow' : undeclared identifier
>C:\test\ISVtest\MyvtkWin32RenderWindowInteractor.cpp(35) 
>: error C2065: 'ren' : undeclared identifier
>C:\test\ISVtest\MyvtkWin32RenderWindowInteractor.cpp(35) 
>: warning C4552: '*' : operator has no effect; 
>expected operator with side-effect
>C:\test\ISVtest\MyvtkWin32RenderWindowInteractor.cpp(36) 
>: error C2061: syntax error : identifier 'vtkWin32OpenGLRenderWindow'
>C:\test\ISVtest\MyvtkWin32RenderWindowInteractor.cpp(37) 
>: error C2059: syntax error : ')'
>C:\test\ISVtest\MyvtkWin32RenderWindowInteractor.cpp(50) 
>: error C2065: 'vtkSetWindowLong' : undeclared identifier
>
>the code is:
>
>file .h
>
>////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>#include "vtkWin32RenderWindowInteractor.h"
>
>class CvtkWin32RenderWindowInteractor : public vtkWin32RenderWindowInteractor
>{
>
>public:
>     static CvtkWin32RenderWindowInteractor *New();
>
>     virtual void OnMouseMove  (HWND wnd, UINT nFlags, int X, int Y);
>     virtual void OnNCMouseMove(HWND wnd, UINT nFlags, int X, int Y);
>     virtual void OnRButtonDown(HWND wnd, UINT nFlags, int X, int Y);
>     virtual void OnRButtonUp  (HWND wnd, UINT nFlags, int X, int Y);
>     virtual void OnMButtonDown(HWND wnd, UINT nFlags, int X, int Y);
>     virtual void OnMButtonUp  (HWND wnd, UINT nFlags, int X, int Y);
>     virtual void OnLButtonDown(HWND wnd, UINT nFlags, int X, int Y);
>     virtual void OnLButtonUp  (HWND wnd, UINT nFlags, int X, int Y);
>     virtual void OnSize       (HWND wnd, UINT nType,  int X, int Y);
>     virtual void OnTimer      (HWND wnd, UINT nIDEvent);
>     virtual void OnKeyDown    (HWND wnd, UINT 
> nChar, UINT nRepCnt, UINT nFlags);
>     virtual void OnKeyUp      (HWND wnd, UINT 
> nChar, UINT nRepCnt, UINT nFlags);
>     virtual void OnChar       (HWND wnd, UINT 
> nChar, UINT nRepCnt, UINT nFlags);
>
>protected:
>
>     CvtkWin32RenderWindowInteractor();
>     virtual ~CvtkWin32RenderWindowInteractor();
>
>};
>////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>file .cpp
>////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>CvtkWin32RenderWindowInteractor::CvtkWin32RenderWindowInteractor()
>{
>   static int timerId           = 1;
>   this->WindowId           = 0;
>   this->TimerId            = timerId++;
>   this->InstallMessageProc = 1;
>   this->MouseInWindow = 0;
>}
>
>CvtkWin32RenderWindowInteractor::~CvtkWin32RenderWindowInteractor()
>{
>
>     CvtkWin32OpenGLRenderWindow *tmp;
>
>   // we need to release any hold we have on a windows event loop
>   if (this->WindowId && this->Enabled && this->InstallMessageProc)
>     {
>     vtkWin32OpenGLRenderWindow *ren;
>     ren = static_cast<vtkWin32OpenGLRenderWindow *>(this->RenderWindow);
>     tmp = (vtkWin32OpenGLRenderWindow *)(vtkGetWindowLong(this->WindowId,4));
>     // watch for odd conditions
>     if ((tmp != ren) && (ren != NULL))
>       {
>       // OK someone else has a hold on our event handler
>       // so lets have them handle this stuff
>       // well send a USER message to the other
>       // event handler so that it can properly
>       // call this event handler if required
> 
>CallWindowProc(this->OldProc,this->WindowId,WM_USER+14,28,(LONG)this->OldProc);
>       }
>     else
>       {
>       vtkSetWindowLong(this->WindowId,GWL_WNDPROC,(LONG)this->OldProc);
>       }
>     this->Enabled = 0;
>     }
>}
>
>void 
>CvtkWin32RenderWindowInteractor::OnMouseMove 
>(HWND wnd, UINT nFlags, int X, int Y)
>{
>}
>void 
>CvtkWin32RenderWindowInteractor::OnNCMouseMove(HWND 
>wnd, UINT nFlags, int X, int Y)
>{
>}
>void 
>CvtkWin32RenderWindowInteractor::OnRButtonDown(HWND 
>wnd, UINT nFlags, int X, int Y)
>{
>}
>void 
>CvtkWin32RenderWindowInteractor::OnRButtonUp 
>(HWND wnd, UINT nFlags, int X, int Y)
>{
>}
>void 
>CvtkWin32RenderWindowInteractor::OnMButtonDown(HWND 
>wnd, UINT nFlags, int X, int Y)
>{
>}
>void 
>CvtkWin32RenderWindowInteractor::OnMButtonUp 
>(HWND wnd, UINT nFlags, int X, int Y)
>{
>}
>void 
>CvtkWin32RenderWindowInteractor::OnLButtonDown(HWND 
>wnd, UINT nFlags, int X, int Y)
>{
>}
>void 
>CvtkWin32RenderWindowInteractor::OnLButtonUp 
>(HWND wnd, UINT nFlags, int X, int Y)
>{
>}
>void 
>CvtkWin32RenderWindowInteractor::OnSize 
>(HWND wnd, UINT nType,  int X, int Y)
>{
>}
>void CvtkWin32RenderWindowInteractor::OnTimer      (HWND wnd, UINT nIDEvent)
>{
>}
>void 
>CvtkWin32RenderWindowInteractor::OnKeyDown 
>(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags)
>{
>}
>void 
>CvtkWin32RenderWindowInteractor::OnKeyUp 
>(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags)
>{
>}
>void 
>CvtkWin32RenderWindowInteractor::OnChar 
>(HWND wnd, UINT nChar, UINT nRepCnt, UINT nFlags)
>{
>}
>////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>of course with vtkWin32RenderWindowInteractor.h include
>
>Somebody can help me?
>
>Thanks
>--
>Diego Armando Parada Cuervo
>Estudiante de Ingeniería de Sistemas y Computación
>Universidad Pedagógica y Tecnológica de Colombia
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
>http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers




More information about the vtkusers mailing list