<div class="gmail_quote">On Thu, Mar 4, 2010 at 6:29 AM, Adeline Joliet <span dir="ltr"><<a href="mailto:adeline_joli@hotmail.com">adeline_joli@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>
Hi vtk users,<br><br><br>I need some help with the vtkSphereWidget. I managed to use it but now I need to detect when the Left Button is released (or pressed whatever)<br>SO i did something like that: <br><br><br> sphereCallback = vtkSphereCallback::New();<br>
<br> sphereCallback->m_myClass= this;<br><br> m_lineWidget->GetSphereSource ()->AddObserver(vtkCommand::LeftButtonReleaseEvent,sphereCallback);<br><br><br><br>where vtkSPhereCallBack is<br><br><br>class vtkSphereCallback : public vtkCommand<br>
{<br> public:<br> static vtkSphereCallback *New()<br> {<br> return new vtkSphereCallback;<br> }<br> <br> virtual void Execute(vtkObject *caller, unsigned long, void*)<br> { <br>                  }<br>
<br> <br> }<br> vtkSphereCallback():m_myClass(0){}<br> MyClass * m_myClass;<br> <br>};<br><br><br><br><br><br>But It doesn't work... the callback is not called when I release the the left button on the sphere... BUT if if put vtkCommand::InteractionEvent<br>
instead of vtkCommand::LeftButtonReleaseEvent in this case it works .. ! the callback is called... but now it will be called for everything.. but still not for the mouse click unclick...<br>Even if I put " if (vtkCommand::LeftButtonReleaseEvent) {} " in the Execute function...<br>
<br><br><br><br>Does someone has any Idea why ?,<br><br><br>Regards,<br>Adeline<br></div><div><br></div></blockquote><div><br></div><div>I believe it is because that event is simply not handled by the widget. If you look here:</div>
<a href="http://www.vtk.org/doc/nightly/html/classvtkSphereWidget.html#_details">http://www.vtk.org/doc/nightly/html/classvtkSphereWidget.html#_details</a></div><div class="gmail_quote"><br></div><div class="gmail_quote">
You will see InteractionEvent, but not LeftButton*</div><div class="gmail_quote"><br></div><div class="gmail_quote">I tried to subclass the sphere widget and catch the event:</div><div class="gmail_quote"><a href="http://www.vtk.org/Wiki/VTK/Examples/Widgets/SphereWidgetEvents">http://www.vtk.org/Wiki/VTK/Examples/Widgets/SphereWidgetEvents</a></div>
<div class="gmail_quote"><br></div><div class="gmail_quote">but it didn't work. Anyone know why?</div><div class="gmail_quote"><br clear="all">Thanks,<br><br>David</div>