[vtkusers] wxVTKWindow and mouse events

Brad Arthur mailinglist at evscorp.com
Tue Sep 24 10:31:34 EDT 2013


Hello,

I am writing a volume viewer using VTK and wxWindows.  I'm using Brian
Todd's wxVTKWindow class to render into a wxWindow.  My code works good
under Linux, but under Win98 and WinNT my mouse event is not being called.

Does anyone know why the code below would not work on Win98/NT?  Placing the
mouse event handler in the EVSFrame, and wxVTKWindow classes (instead of
EVSResliceCanvas) does not work.  Am I taking the wrong approach in creating
a wxFrame and attaching the wxVTKWindow to it?

Could someone please send me some sample code which implements wxVTKWindow,
and which works under Win98/NT?

Thank you!!
Brad


// Container for the wxVTKWindow
class EVSFrame: public wxFrame
{
public:
 EVSFrame(wxWindow *window, const wxString& title, const wxPoint& pos,
  const wxSize& size, long lStyle);

 void OnCloseWindow(wxCloseEvent& event);
 void OnExit(wxCommandEvent& event);

 DECLARE_EVENT_TABLE()
};


// Class to handle mouse events, etc.
class EVSResliceCanvas: public wxVTKWindow
{
public:
 EVSResliceCanvas(wxFrame *wfFrame);

 void OnPaint(wxPaintEvent& event);
 void OnMouseEvent(wxMouseEvent& event);

 DECLARE_EVENT_TABLE()
};

EVSResliceCanvas::EVSResliceCanvas(wxFrame *wfFrame):
 wxVTKWindow(wfFrame, -1)
{
}


wxApp::OnInit()
{
  :
 VTK initialization
  :

 // Create the main frame window
 this->evsFrame = new EVSFrame(NULL, sTitle, wpPosition, wsSize, lStyle);

 // Allow rendering into the frame
 this->evsResliceCanvas = new EVSResliceCanvas(this->evsFrame);
 this->evsResliceCanvas->SetVTKWindow(this->renderWindow);

 // Show the frame
 this->evsFrame->Show(true);
}





More information about the vtkusers mailing list