diff --git a/include/osgUI/LineEdit b/include/osgUI/LineEdit index bb1dd8420..5b79f3a2e 100644 --- a/include/osgUI/LineEdit +++ b/include/osgUI/LineEdit @@ -29,8 +29,7 @@ public: virtual bool handleImplementation(osgGA::EventVisitor* ev, osgGA::Event* event); - void setText(const std::string& text) { _text = text; dirty(); } - std::string& getText() { return _text; } + void setText(const std::string& text); const std::string& getText() const { return _text; } virtual void createGraphicsImplementation(); diff --git a/src/osgUI/Dialog.cpp b/src/osgUI/Dialog.cpp index b4d8daa84..4aaade2e5 100644 --- a/src/osgUI/Dialog.cpp +++ b/src/osgUI/Dialog.cpp @@ -39,13 +39,15 @@ bool Dialog::handleImplementation(osgGA::EventVisitor* ev, osgGA::Event* event) switch(ea->getEventType()) { - case(osgGA::GUIEventAdapter::KEYDOWN): + //case(osgGA::GUIEventAdapter::KEYDOWN): + case(osgGA::GUIEventAdapter::KEYUP): OSG_NOTICE<<"Key pressed : "<getKey()<getKey()==osgGA::GUIEventAdapter::KEY_Escape) + if (ea->getKey()=='c') { close(); - dirty(); + ea->setHandled(true); + return true; } diff --git a/src/osgUI/LineEdit.cpp b/src/osgUI/LineEdit.cpp index c1a635a48..3299a03c6 100644 --- a/src/osgUI/LineEdit.cpp +++ b/src/osgUI/LineEdit.cpp @@ -43,13 +43,20 @@ bool LineEdit::handleImplementation(osgGA::EventVisitor* ev, osgGA::Event* event if (ea->getKey()==osgGA::GUIEventAdapter::KEY_BackSpace || ea->getKey()==osgGA::GUIEventAdapter::KEY_Delete) { - if (!_text.empty()) _text.erase(_text.size()-1, 1); + if (!_text.empty()) + { + _text.erase(_text.size()-1, 1); + if (_textDrawable) _textDrawable->setText(_text); + return true; + + } } else if (ea->getKey()>=32 && ea->getKey()<=0xff00) { _text.push_back(ea->getKey()); + if (_textDrawable) _textDrawable->setText(_text); + return true; } - dirty(); OSG_NOTICE<<"Key pressed : "<getKey()<setText(_text); +} + + + void LineEdit::createGraphicsImplementation() {