diff --git a/src/osgUI/ComboBox.cpp b/src/osgUI/ComboBox.cpp index e2ec9217b..c06cae7bb 100644 --- a/src/osgUI/ComboBox.cpp +++ b/src/osgUI/ComboBox.cpp @@ -40,7 +40,11 @@ bool ComboBox::handleImplementation(osgGA::EventVisitor* ev, osgGA::Event* event osgGA::GUIEventAdapter* ea = event->asGUIEventAdapter(); if (!ea) return false; - if (!getHasEventFocus()) + + bool hasFocus = getHasEventFocus() || + (_popup->getVisible() && _popup->getHasEventFocus()); + + if (!hasFocus) { if (ea->getEventType()==osgGA::GUIEventAdapter::PUSH && _popup->getVisible()) { @@ -84,14 +88,16 @@ bool ComboBox::handleImplementation(osgGA::EventVisitor* ev, osgGA::Event* event { OSG_NOTICE<<"Button pressed "<getActionAdapter() : 0; osgGA::GUIEventAdapter* ea = event ? event->asGUIEventAdapter() : 0; -// if ((aa && ea) && aa->computeIntersections(*ea, ev->getNodePath(), intersections)) - if ((aa && ea) && computeIntersections(ev, ea, intersections)) + if ((aa && ea) && aa->computeIntersections(*ea, ev->getNodePath(), intersections)) +// if ((aa && ea) && computeIntersections(ev, ea, intersections)) { OSG_NOTICE<<"ComboBox intersections { "<setVisible(false); } break; @@ -284,8 +291,8 @@ void ComboBox::createGraphicsImplementation() float itemHeight = (_extents.yMax()-_extents.yMin()) - 2.0f*frameWidth; float popupHeight = (itemHeight)* _items.size() + margin*static_cast(_items.size()-1) + 2.0f*frameWidth; float popupTop = _extents.yMin()-frameWidth-margin*1.0f; - float popupLeft = _extents.xMin(); - float popupRight = _extents.xMax(); + float popupLeft = _extents.xMin()+30.0f; + float popupRight = _extents.xMax()+30.0f; osg::BoundingBox popupExtents(popupLeft, popupTop-popupHeight, _extents.zMin(), popupRight, popupTop, _extents.zMax()); _popup->setExtents(popupExtents);