Hi All.

I am using OSG in my Project. I Have a requirement to handle the 
combination keys from KeyBoard,For E.g ctrl + S , ctrl + q etc.

Seeing the documentation i have inherited my class from 
osgGA::GUIEventHandler and implemented handle virtual function to recieve 
the keyboard Events.

Here is my Handle Function

 bool MyKeyboardHandle::handle(const osgGA::GUIEventAdapter& ea, 
osgGA::GUIActionAdapter& aa)
{

    viewer = dynamic_cast<osgViewer::View*>(&aa);
    if (viewer)
    {
        switch (ea.getEventType())
        {
            case(osgGA::GUIEventAdapter::KEYDOWN):
            {
                if (ea.getModKeyMask() & 
osgGA::GUIEventAdapter::MODKEY_CTRL)
                {
                    if (ea.getKey() == osgGA::GUIEventAdapter::KEY_S)
                    {
                        //call my specific function here
.                      // I want to call my function here
                    }
                }
            }
            break;

            default:
                break;
        }
    }
    return false;
}

If i debug my program, i can see control reaching until this condition if 
(ea.getModKeyMask() & osgGA::GUIEventAdapter::MODKEY_CTRL) when i press 
combination keys( ctrl + s) . But next if condition fails where i am 
checking if the key pressed is 's'.

Can you guys guide me is my code correct to handle combination keys from 
keyboard, If you can guide to any examples, that will really helpful

Thanks & Rgds
santhosh

-- 
You received this message because you are subscribed to the Google Groups 
"OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osg-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osg-users/e54835af-6e75-44d3-97ab-017ea100040c%40googlegroups.com.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to