<div class="gmail_quote">On Fri, Jan 22, 2010 at 3:21 PM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I'm not sure what #defines you are talking about, but why not use the<br>
interactor "GetKeySym" method to detect arrow keys? They have the<br>
names "Up", "Down", "Left", "Right".<br>
<br>
David<br>
<div><div></div><div class="h5"><br>
<br>
On Fri, Jan 22, 2010 at 1:18 PM, David Doria <<a href="mailto:daviddoria%2Bvtk@gmail.com">daviddoria+vtk@gmail.com</a>> wrote:<br>
> It seems that for win32, there are some #defines for arrow keys like<br>
> VK_RIGHT. I can't seem to find what should be done for non win32 - any<br>
> thoughts?<br>
><br>
> Thanks,<br>
><br>
> David<br>
</div><div class="h5"><br></div></div></blockquote><div><br></div><div>So typically I do this from inside my InteractorStyle subclass:</div><div><div> </div><div> virtual void OnChar() </div><div> {</div><div> vtkRenderWindowInteractor *rwi = this->Interactor;<span class="Apple-tab-span" style="white-space:pre">                </span></div>
<div> </div><div> char ch = rwi->GetKeyCode() ;</div><div><br></div><div> switch (ch) </div><div> {</div><div> case 's':</div><div> cout << "Pressed s." << endl;</div>
<div> break;</div><div> case 'a':</div><div> cout << "Pressed a." << endl;</div><div> break ;</div><div> default:</div><div> cout << "Pressed an unhandled key: " << rwi->GetKeyCode() << endl;</div>
<div> break;</div><div> }</div><div><br></div><div>The problem is that OnChar() doesn't fire when the arrow keys are pressed. I tried to use</div><div><br></div><div><div> virtual void OnKeyDown() </div>
<div> {</div><div> vtkRenderWindowInteractor *rwi = this->Interactor; </div><div> </div><div> if(rwi->GetKeySym() == "Up")</div><div> {</div><div> cout << "Pressed up." << endl;</div>
<div> }</div><div> </div><div> // forward events</div><div> vtkInteractorStyleTrackballCamera::OnKeyDown();</div><div> }</div></div></div><div class="gmail_quote"><br></div><div class="gmail_quote">
But it doesn't seem to compare to true. It also doesn't seem to flush the buffer when I would expect?</div><div class="gmail_quote"><br></div><div class="gmail_quote">Also, what is the difference between KeyPress and KeyDown? The documentation is kind of broken here: <a href="http://www.vtk.org/doc/nightly/html/classvtkInteractorStyle.html#a65fcd9765c162a6021434386037ca641">http://www.vtk.org/doc/nightly/html/classvtkInteractorStyle.html#a65fcd9765c162a6021434386037ca641</a></div>
<br clear="all">Thanks,<br><br>David</div>