[vtkusers] Mouse button release event is still broken in VTK 6.0.0 !

Mengda Wu wumengda at gmail.com
Sun Dec 1 21:18:56 EST 2013


Hi all,

   I found this series is very relevant to my issue.

   I am also trying to catch the LeftButtonReleaseEvent event in VTK 6.0.0.
I believe it is still broken. Basically, I added observers of
LeftButtonPressEvent, MouseMoveEvent, and LeftButtonReleaseEvent to
RenderWindowInteractor. Only LeftButtonPressEvent and  MouseMoveEvent got
tracked in the C++ callback function. No LeftButtonReleaseEvent was
observed.

What I did was:

vtkSmartPointer<CRRotateCallBack> crk =
vtkSmartPointer<CRRotateCallBack>::New();

this->ui->view1->GetInteractor()->AddObserver(vtkCommand::LeftButtonPressEvent,
crk, 10.0f);
this->ui->view1->GetInteractor()->AddObserver(vtkCommand::MouseMoveEvent,
crk, 10.0f);
this->ui->view1->GetInteractor()->AddObserver(vtkCommand::LeftButtonReleaseEvent,
crk, 10.0f);

class CRRotateCallBack : public vtkCommand
{
public:
    static CRRotateCallBack *New() {return new CRRotateCallBack;}

    virtual void Execute(vtkObject *caller, unsigned long eventId, void*)
    {
        vtkRenderWindowInteractor *iren =
vtkRenderWindowInteractor::SafeDownCast(caller);
        if( !iren ) return;

        if( eventId == vtkCommand::LeftButtonPressEvent )
        {
            std::cout << "LeftButtonPressEvent" << std::endl;
        }
        else if( eventId == vtkCommand::MouseMoveEvent )
        {
            std::cout << "MouseMoveEvent " << std::endl;
        }
        else if( eventId == vtkCommand::LeftButtonReleaseEvent )    //for
some reason, this left mouse release event never gets here
        {
            std::cout << "LeftButtonReleaseEvent " << std::endl;
        }
    }
};

Thanks,
Mengda


On Mon, Oct 31, 2011 at 4:25 PM, Sebastien Jourdain <
sebastien.jourdain at kitware.com> wrote:

> Hi Max,
>
> I get that but when I was monitoring the event that was happening on a
> C++ observer, I've noticed the following order.
>
> LeftButtonPressEvent
> StartInteractionEvent
> ModifiedEvent
> EndInteractionEvent
> RenderEvent
>
> So despite the fact that ReleaseEvent is not properly propagated (even
> in the C++ layer), I was wondering if you could rely on the
> EndInteractionEvent while we fix this bug ? Because, this event seems
> to map at the release time...
>
> Does it make sense ?
>
> At lease let me know if this could fix your issue temporarily...
>
> Thanks,
>
> Seb
>
> PS: If I get more time, I will track down the reason why the
> ReleaseEvent get digested...
>
>
> On Mon, Oct 31, 2011 at 4:16 PM, EvilMax <maxim.privalov at gmail.com> wrote:
> > Hi, Sebastien!
> >
> > I need to implement dragging of an actors, so I really need to track
> mouse
> > button release event.
> >
> > --
> > View this message in context:
> http://vtk.1045678.n5.nabble.com/Mouse-button-release-is-still-broken-in-5-8-0-tp4949887p4953458.html
> > Sent from the VTK - Users mailing list archive at Nabble.com.
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20131201/db40f751/attachment.htm>


More information about the vtkusers mailing list