diff options
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/inttextfield.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/textfield.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/textfield.h | 7 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp index 021340fbe..89544e108 100644 --- a/src/gui/widgets/inttextfield.cpp +++ b/src/gui/widgets/inttextfield.cpp @@ -50,6 +50,9 @@ void IntTextField::keyPressed(gcn::KeyEvent &event) key.getValue() == Key::DELETE) { setText(std::string()); + if (mSendAlwaysEvents) + distributeActionEvent(); + event.consume(); } @@ -62,6 +65,8 @@ void IntTextField::keyPressed(gcn::KeyEvent &event) int i; s >> i; setValue(i); + if (mSendAlwaysEvents) + distributeActionEvent(); } void IntTextField::setRange(int min, int max) diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 5d4fbc0b4..6ce4cbf3b 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -51,11 +51,11 @@ TextField::TextField(const std::string &text, bool loseFocusOnTab, gcn::ActionListener* listener, std::string eventId, bool sendAlwaysEvents): gcn::TextField(text), + mSendAlwaysEvents(sendAlwaysEvents), mNumeric(false), mMinimum(0), mMaximum(0), - mLastEventPaste(false), - mSendAlwaysEvents(sendAlwaysEvents) + mLastEventPaste(false) { setFrameSize(2); diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index 7e19099e8..93f970168 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -96,6 +96,12 @@ class TextField : public gcn::TextField */ int getValue() const; + void setSendAlwaysEvents(bool b) + { mSendAlwaysEvents = b; } + + protected: + bool mSendAlwaysEvents; + private: void handlePaste(); @@ -109,7 +115,6 @@ class TextField : public gcn::TextField int mMaximum; bool mLoseFocusOnTab; int mLastEventPaste; - bool mSendAlwaysEvents; }; #endif |