[vtkusers] Interaction with VTK window

subin supersub at ccea.zju.edu.cn
Sun Oct 19 04:24:23 EDT 2003


hi:
    There is no any MessageBox appear in my program when left button is down or up . I can't find out the problem. Can anybody give me a sample?
----------------------------
good luck !
      subin ^_^


----- Original Message ----- 
From: "de Boer Ingo" <I.deBoer at polytec.de>
To: "subin" <supersub at ccea.zju.edu.cn>; <vtkusers at vtk.org>
Sent: Monday, October 13, 2003 8:11 PM
Subject: AW: [vtkusers] Interaction with VTK window


> I'm going to write a program with VTK in MFC. I don't know how to interact with the VTK window.
> If anyone can show me how to do it or show me some examples?
Make your own "vtkMyInteractorStyle" based on e.g. vtkInteractorStyleTrackballCamera.
Like this:

#include "vtkInteractorStyleTrackballCamera.h"

class vtkMyInteractorStyle : public vtkInteractorStyleTrackballCamera
{
public:
static vtkMyInteractorStyle *New();

void OnLeftButtonDown();
void OnLeftButtonUp();

protected:
vtkMyInteractorStyle();
};


vtkStandardNewMacro(vtkMyInteractorStyle);

vtkMyInteractorStyle::vtkMyInteractorStyle() : vtkInteractorStyleTrackballCamera()
{
}

void vtkMyInteractorStyle::OnLeftButtonDown()
{
  AfxMessageBox("left button down");
}
void vtkMyInteractorStyle::OnLeftButtonUp()
{
  AfxMessageBox("left button up");
}

Add the interactor to your renderer, like
m_pvtkWin32RenderWI->SetInteractorStyle(m_pvtkMyInteractorStyle);

greets
  Ingo


More information about the vtkusers mailing list