<div class="gmail_quote">On Fri, Jan 22, 2010 at 3:21 PM, David Gobbi <span dir="ltr">&lt;<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I&#39;m not sure what #defines you are talking about, but why not use the<br>
interactor &quot;GetKeySym&quot; method to detect arrow keys?  They have the<br>
names &quot;Up&quot;, &quot;Down&quot;, &quot;Left&quot;, &quot;Right&quot;.<br>
<br>
    David<br>
<div><div></div><div class="h5"><br>
<br>
On Fri, Jan 22, 2010 at 1:18 PM, David Doria &lt;<a href="mailto:daviddoria%2Bvtk@gmail.com">daviddoria+vtk@gmail.com</a>&gt; wrote:<br>
&gt; It seems that for win32, there are some #defines for arrow keys like<br>
&gt; VK_RIGHT. I can&#39;t seem to find what should be done for non win32 - any<br>
&gt; thoughts?<br>
&gt;<br>
&gt; Thanks,<br>
&gt;<br>
&gt; 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-&gt;Interactor;<span class="Apple-tab-span" style="white-space:pre">                </span></div>
<div>        </div><div>      char ch = rwi-&gt;GetKeyCode() ;</div><div><br></div><div>      switch (ch) </div><div>      {</div><div>        case &#39;s&#39;:</div><div>          cout &lt;&lt; &quot;Pressed s.&quot; &lt;&lt; endl;</div>
<div>          break;</div><div>        case &#39;a&#39;:</div><div>          cout &lt;&lt; &quot;Pressed a.&quot; &lt;&lt; endl;</div><div>          break ;</div><div>        default:</div><div>          cout &lt;&lt; &quot;Pressed an unhandled key: &quot; &lt;&lt; rwi-&gt;GetKeyCode() &lt;&lt; endl;</div>
<div>          break;</div><div>      }</div><div><br></div><div>The problem is that OnChar() doesn&#39;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-&gt;Interactor;    </div><div>      </div><div>      if(rwi-&gt;GetKeySym() == &quot;Up&quot;)</div><div>      {</div><div>        cout &lt;&lt; &quot;Pressed up.&quot; &lt;&lt; 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&#39;t seem to compare to true. It also doesn&#39;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>