Hi,

This is designed behavior, all event handlers get the event and can
decide whether they are happy to handle already handled events or not.
If GUIEventAdapter::getHandled() returns true then the events is
already handled. The Drive/Flight/Tracball etc manipulators now all
check to see an an event has been handled before handling the event -
have a browse through the osgGA source to see how its done.

Robert.



On 6/29/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
hi , all
    I use OSG2.0 in windows XP.  The source is downloaded using svn.
    I add two   GUIEventHandler(GUIEventHandler_A and GUIEventHandler_B) to 
viewer's eventhandlers.
    viewer.addEventHandler(a);
        viewer.addEventHandler(b);

        withd same event , for example "PUSH" event,  although 
GUIEventHandler_A return true, the  GUIEventHandler_B
will also receive the "PUSH" event. In OSG1.2,   GUIEventHandler_B cannot 
receive this event when some
pre GUIEventHandler return true.

     Is it a bug or  designing behavior?

the source code in Viewer.cpp  is about line 2090 to 2013 .
        for(EventHandlers::iterator hitr = _eventHandlers.begin();
            hitr != _eventHandlers.end();
            ++hitr)
        {
            if ((*hitr)->handle( *event, *this, 0, 0)) event->setHandled(true);
        }

        if (_cameraManipulator.valid())
        {
            if (_cameraManipulator->handle( *event, *this)) 
event->setHandled(true);
        }

I change it to followint to simluate osg1.2 behavior.

        for(EventHandlers::iterator hitr = _eventHandlers.begin();
            hitr != _eventHandlers.end();
            ++hitr)
        {
                        if(!event->getHandled())    //add this line
                        {
                                if ((*hitr)->handle( *event, *this, 0, 0)) 
event->setHandled(true);
                        }
        }

        if (_cameraManipulator.valid() && !event->getHandled())  //change this 
line
        {
            if (_cameraManipulator->handle( *event, *this)) 
event->setHandled(true);
        }




_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to