<div dir="ltr"><div><span style="text-align:-webkit-auto">Hi all,</span><div style="text-align:-webkit-auto"><br></div><div style="text-align:-webkit-auto">I am playing with the vtkSeedWidget example, which is available from:</div><div style="text-align:-webkit-auto"><a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/SeedWidget">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/SeedWidget</a></div><div style="text-align:-webkit-auto"><br></div><div style="text-align:-webkit-auto">I am stuck at how to add kepress event.</div><div style="text-align:-webkit-auto"><br></div><div style="text-align:-webkit-auto">I tried to add </div><div style="text-align:-webkit-auto"> seedWidget->AddObserver(vtkCommand::KeyPressEvent,seedCallback);<br></div><div style="text-align:-webkit-auto"><br></div><div style="text-align:-webkit-auto">right after the following lines:</div><div style="text-align:-webkit-auto"> seedWidget->AddObserver(vtkCommand::PlacePointEvent,seedCallback);</div><div style="text-align:-webkit-auto"> seedWidget->AddObserver(vtkCommand::InteractionEvent,seedCallback);</div><div style="text-align:-webkit-auto"><br></div><div style="text-align:-webkit-auto"><br></div><div style="text-align:-webkit-auto"> Another change is in class <span style="color:rgb(0,0,0);font-size:10.3999996185303px;line-height:1.2em">vtkSeedCallback::Execute</span></div><div style="text-align:-webkit-auto">I add one if-else blcok to capture keypress event.</div><div style="text-align:-webkit-auto"><br></div><div style="text-align:-webkit-auto"><pre style="padding:0px;border:0px none white;margin-top:0px;margin-bottom:0px;vertical-align:top;background-image:none"><span style="color:rgb(0,0,255);font-size:10.3999996185303px;line-height:1.2em">virtual</span><font color="#000000"><span style="font-size:10.3999996185303px;line-height:1.2em"> </span></font><span style="color:rgb(0,0,255);font-size:10.3999996185303px;line-height:1.2em">void</span><font color="#000000"><span style="font-size:10.3999996185303px;line-height:1.2em"> Execute</span></font><span style="color:rgb(0,128,0);font-size:10.3999996185303px;line-height:1.2em">(</span><font color="#000000"><span style="font-size:10.3999996185303px;line-height:1.2em">vtkObject</span></font><span style="color:rgb(0,0,64);font-size:10.3999996185303px;line-height:1.2em">*</span><font color="#000000"><span style="font-size:10.3999996185303px;line-height:1.2em">, </span></font><span style="color:rgb(0,0,255);font-size:10.3999996185303px;line-height:1.2em">unsigned</span><font color="#000000"><span style="font-size:10.3999996185303px;line-height:1.2em"> </span></font><span style="color:rgb(0,0,255);font-size:10.3999996185303px;line-height:1.2em">long</span><font color="#000000"><span style="font-size:10.3999996185303px;line-height:1.2em"> event, </span></font><span style="color:rgb(0,0,255);font-size:10.3999996185303px;line-height:1.2em">void</span><font color="#000000"><span style="font-size:10.3999996185303px;line-height:1.2em"> </span></font><span style="color:rgb(0,0,64);font-size:10.3999996185303px;line-height:1.2em">*</span><font color="#000000"><span style="font-size:10.3999996185303px;line-height:1.2em">calldata</span></font><span style="color:rgb(0,128,0);font-size:10.3999996185303px;line-height:1.2em">)</span><font color="#000000"><span style="font-size:10.3999996185303px;line-height:1.2em">
</span></font><span style="color:rgb(0,128,0);font-size:10.3999996185303px;line-height:1.2em">{</span><font color="#000000"><span style="font-size:10.3999996185303px;line-height:1.2em">
</span></font><font color="#0000FF"><span style="font-size:10px;line-height:12.4799995422363px">if (event == vtkCommand::KeyPressEvent)
{
std::cout<<"key press"<<std::endl;
}</span></font></pre><pre style="padding:0px;border:0px none white;color:rgb(0,0,0);line-height:1.2em;font-size:10.3999996185303px;margin-top:0px;margin-bottom:0px;vertical-align:top;background-image:none"><span style="color:rgb(0,128,0)">...</span></pre><pre style="padding:0px;border:0px none white;color:rgb(0,0,0);line-height:1.2em;font-size:10.3999996185303px;margin-top:0px;margin-bottom:0px;vertical-align:top;background-image:none"><span style="color:rgb(0,128,0)">}</span></pre></div><div style="text-align:-webkit-auto"><br></div><div style="text-align:-webkit-auto">However, the widget can not capture keypress event.<br></div><div style="text-align:-webkit-auto"><br></div><div style="text-align:-webkit-auto">Could anyone share the idea to add customized event in vtkSeedWidget? Thanks.</div></div></div>