[vtkusers] AddObserver- callbacks

Mathieu Malaterre Mathieu.Malaterre at creatis.insa-lyon.fr
Thu Sep 18 08:14:49 EDT 2003


ted lee wrote:
> hi Mathieu.. thanx Mathieu for your help..i read the example very
> well but i have this problem..when i'm using this code to view and
> get the Right button Mouse action(here the action to disply the
> message box) the image displayed but i don't now how can i use the
> AddObserver() func/and it's call back.., also where should i call
> MyAction function? i'm trying to handle the message using MFC
> (OnleftButtonDown) but nothing done..)... sorry for my poor english
> and  my not understanding this problem here is the line to interact
> with the rendered window..
> 
> vtkImageActor *imageactor=vtkImageActor::New(); 
> imageactor->SetInput(Reader->GetOutput());
> 
> vtkInteractorStyleImage *imageinteractor =
> vtkInteractorStyleImage::New();
> 
> imageinteractor->AddObserver vtkCommand::RightButtonPressEvent,NULL);
> //MyAction()should be put here?
> 
> iren->SetInteractorStyle(imageinteractor);  
> aRenderer->AddActor(imageactor); renWin->SetSize(400,400); 
> iren->Initialize(); iren->Start(); 
> 
> void CVtkMDIView::MyAction() { AfxMessageBox("hi"); }
> 

Ted,

	Have a look at:

VTK/Examples/GUI/Win32/vtkBorland/Package/vtkBorlandRenderWindow.cpp

	Or:

VTK/Examples/Tutorial/Step2/Cxx/Cone2.cxx

VTK/Examples/Tutorial/Step6/Cxx/Cone6.cxx


HTH
mathieu




More information about the vtkusers mailing list