# \[RESOLVED\]: Issue LeftButtonPressEvent() to vtkRenderWindowInteractor with C++?

**URL:** https://discourse.vtk.org/t/resolved-issue-leftbuttonpressevent-to-vtkrenderwindowinteractor-with-c/3858
**Category:** Support
**Created:** [July 27, 2020, 11:19pm UTC](https://discourse.vtk.org/t/resolved-issue-leftbuttonpressevent-to-vtkrenderwindowinteractor-with-c/3858 "2020-07-27T23:19:56Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Tomasso](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tomasso/32/5786_2.png) [@Tomasso](https://discourse.vtk.org/u/Tomasso)
#### Post date: [July 27, 2020, 11:19pm UTC](https://discourse.vtk.org/t/resolved-issue-leftbuttonpressevent-to-vtkrenderwindowinteractor-with-c/3858/1 "2020-07-27T23:19:56Z")

</div>

My C++ application displays an actor in a vtkRenderWindow, with an associated vtkGenericRenderWindowInteractor. If in “camera mode” and I left-click the mouse in the window at position x,y the surface is rendered from a different view angle (i.e. the camera is moved). I want to issue the equivalent through C++ such that the camera view is changed as if I manually clicked the mouse.

I tried this:

```
   interactor_->SetEventPosition(x, y);
   interactor_->LeftButtonPressEvent();
   renderWindow->Render();

```

But the camera doesn’t move. What else do I need to do?

Thanks!

---

<div class="post-metadata">

### Author: ![Tomasso](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tomasso/32/5786_2.png) [@Tomasso](https://discourse.vtk.org/u/Tomasso)
#### Post date: [July 28, 2020, 6:36pm UTC](https://discourse.vtk.org/t/resolved-issue-leftbuttonpressevent-to-vtkrenderwindowinteractor-with-c/3858/2 "2020-07-28T18:36:37Z")

</div>

I solved this problem by associating TrackBallCamera style with the render window interactor:

```
   renderWindowInteractor_ =
            vtkSmartPointer<vtkGenericRenderWindowInteractor>::New();

    renderWindowInteractor_->EnableRenderOff();

    vtkSmartPointer<vtkInteractorStyleTrackballCamera> style =
            vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New(); 

    renderWindowInteractor_->SetInteractorStyle( style );

```

Now issuing events to the interactor - e.g. LeftButtonPress or MouseMoveEvent with the left button held down - causes the camera angle to change as expected.
