Thanks a lot Jeff.<br>This really worked.<br><br>PS: I hope this message won'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"><<a href="mailto:jeff.baumes@kitware.com">jeff.baumes@kitware.com</a>></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 "selections" 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'd do something like<br>
<br>
win->GetInteractor()->GetInteractorStyle()->AddObserver(vtkCommand::KeyPressEvent,<br>
callback);<br>
<br>
where "win" 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 <<a href="mailto:varguna@gmail.com">varguna@gmail.com</a>> wrote:<br>
> Hi,<br>
> I am currently having problems with my event handler and would appreciate if<br>
> anybody suggests me a solution.<br>
><br>
> The ProcessVertexSelection (user defined) method is activated when some<br>
> selections are made (based on SelectionChangeEvent). Everything is good upto<br>
> this point. Here is the code for this:<br>
><br>
> edgePicked->SetCallback(network->ProcessVertexSelection);<br>
> edgePicked->SetClientData((void *)static_cast<vtkSelectionLink*>(edgeLink));<br>
> selections->AddObserver(vtkCommand::SelectionChangedEvent, edgePicked);<br>
><br>
> This part works and I can get the selections. Now I want to add another<br>
> functionality: The user may want to delete the current selections by using<br>
> key 'd' or "delete" whichever is simple to implement. I know that GetKeySym<br>
> can be used to get key symbol. However, if I add the following code to<br>
> activate another method to do deletions, the event handler ignores it. It<br>
> never activates the method which is named as EVTDelete (in my code) where I<br>
> plan to check which key is used.<br>
><br>
> delPicked->SetCallback(network->EVTDelete);<br>
> delPicked->SetClientData((void *)static_cast<vtkSelectionLink*>(edgeLink));<br>
> selections->AddObserver(vtkCommand::KeyPressEvent, delPicked);<br>
><br>
> Why doesn't my event handler listen do the keypresses other than the default<br>
> ones?<br>
> Thanks a lot.<br>
> Aytekin<br>
><br>
> --<br>
> My web page: <a href="http://www.cs.rpi.edu/%7Evargua" target="_blank">http://www.cs.rpi.edu/~vargua</a><br>
><br>
</div></div>> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
><br>
<font color="#888888"><br>
<br>
<br>
--<br>
Jeff Baumes, Ph.D.<br>
R&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>