Thanks a lot Jeff.<br>This really worked.<br><br>PS: I hope this message won&#39;t create a new thread. I apologize if it happens.<br>Aytekin<br><br><div class="gmail_quote">On Tue, Feb 10, 2009 at 8:38 AM, Jeff Baumes <span dir="ltr">&lt;<a href="mailto:jeff.baumes@kitware.com">jeff.baumes@kitware.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi Aytekin,<br>
<br>
Based on previous emails, I believe your &quot;selections&quot; object is a<br>
vtkDataRepresentation, which does not emit any key press events (or<br>
mouse events). These events are emitted by the interactor style. So<br>
you&#39;d do something like<br>
<br>
win-&gt;GetInteractor()-&gt;GetInteractorStyle()-&gt;AddObserver(vtkCommand::KeyPressEvent,<br>
callback);<br>
<br>
where &quot;win&quot; is your vtkRenderWindow instance. This should be done<br>
after the SetupRenderWindow call.<br>
<br>
Jeff<br>
<div><div></div><div class="Wj3C7c"><br>
On Mon, Feb 9, 2009 at 11:11 AM, Aytekin Vargun &lt;<a href="mailto:varguna@gmail.com">varguna@gmail.com</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt; I am currently having problems with my event handler and would appreciate if<br>
&gt; anybody suggests me &nbsp;a solution.<br>
&gt;<br>
&gt; The ProcessVertexSelection (user defined) method is activated when some<br>
&gt; selections are made (based on SelectionChangeEvent). Everything is good upto<br>
&gt; this point. Here is the code for this:<br>
&gt;<br>
&gt; edgePicked-&gt;SetCallback(network-&gt;ProcessVertexSelection);<br>
&gt; edgePicked-&gt;SetClientData((void *)static_cast&lt;vtkSelectionLink*&gt;(edgeLink));<br>
&gt; selections-&gt;AddObserver(vtkCommand::SelectionChangedEvent, edgePicked);<br>
&gt;<br>
&gt; This part works and I can get the selections. Now I want to add another<br>
&gt; functionality: The user may want to delete the current selections by using<br>
&gt; key &#39;d&#39; or &quot;delete&quot; whichever is simple to implement. I know that GetKeySym<br>
&gt; can be used to get key symbol. However, if I add the following code to<br>
&gt; activate another method to do deletions, the event handler ignores it. It<br>
&gt; never activates the method which is named as EVTDelete (in my code) where I<br>
&gt; plan to check which key is used.<br>
&gt;<br>
&gt; delPicked-&gt;SetCallback(network-&gt;EVTDelete);<br>
&gt; delPicked-&gt;SetClientData((void *)static_cast&lt;vtkSelectionLink*&gt;(edgeLink));<br>
&gt; selections-&gt;AddObserver(vtkCommand::KeyPressEvent, delPicked);<br>
&gt;<br>
&gt; Why doesn&#39;t my event handler listen do the keypresses other than the default<br>
&gt; ones?<br>
&gt; Thanks a lot.<br>
&gt; Aytekin<br>
&gt;<br>
&gt; --<br>
&gt; My web page: <a href="http://www.cs.rpi.edu/%7Evargua" target="_blank">http://www.cs.rpi.edu/~vargua</a><br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; Visit other Kitware open-source projects at<br>
&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;<br>
&gt; Please keep messages on-topic and check the VTK FAQ at:<br>
&gt; <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
&gt;<br>
&gt;<br>
<font color="#888888"><br>
<br>
<br>
--<br>
Jeff Baumes, Ph.D.<br>
R&amp;D Engineer, Kitware Inc.<br>
(518) 371-3971 x132<br>
<a href="mailto:jeff.baumes@kitware.com">jeff.baumes@kitware.com</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>My web page: <a href="http://www.cs.rpi.edu/~vargua">http://www.cs.rpi.edu/~vargua</a><br>