Bruno Fanini schrieb:
Sure!
Maybe I'm missing some important change in OSG 1.2 regarding event
handling... btw code is long, here posting handle() function:


bool BoostManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter&
us){
   switch( ea.getEventType() ){
         // ...
         // other "cases"
         // ...

         case(GUIEventAdapter::SCROLL):{
           addMouseEvent(ea);
osg::notify(ALWAYS) << "Scroll\n"; // This line is printed when
I scroll, OK

           if ( MouseListener() ) us.requestRedraw();
           us.requestContinuousUpdate(true);
           return true;
           }

       case(GUIEventAdapter::SCROLL_UP):{
           addMouseEvent(ea);
           osg::notify(ALWAYS) << "Scroll-up\n";  // NOT PRINTED!!!

           if ( MouseListener() ) us.requestRedraw();
           us.requestContinuousUpdate(true);
           return true;
           }

       case(GUIEventAdapter::SCROLL_DOWN):{
           addMouseEvent(ea);
           osg::notify(ALWAYS) << "Scroll-down\n";  // NOT PRINTED!!!

           if ( MouseListener() ) us.requestRedraw();
           us.requestContinuousUpdate(true);
           return true;
           }
   }

Ah, I see, SCROLL_UP and SCROLL_DOWN aren't event-types, they are scrollMotions. It seems, that the code got refactored a while back.

I think the correct way to handle scrolling-events is:

switch (ea.getEventType()) {
   case GUIEventAdapter::SCROLL:
      case ea.getScrollMotion() {
         case GUIEventAdapter::SCROLL_DOWN:
//handle scroll down; break;
         case GUIEventAdapter::SCROLL_UP:
               //handle scroll up
               break;
      }
      break;
   // case other_event_types...
}

HTH,
Stephan

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

Reply via email to