diff --git a/include/SFGUI/Entry.hpp b/include/SFGUI/Entry.hpp index 6223607c..e0c30c30 100644 --- a/include/SFGUI/Entry.hpp +++ b/include/SFGUI/Entry.hpp @@ -89,6 +89,7 @@ class SFGUI_API Entry : public Widget { // Signals. static Signal::SignalID OnTextChanged; //!< Fired when the text changes. + static Signal::SignalID OnEnterKeyPressed; //!< Fired when the enter key was pressed. protected: /** Ctor. diff --git a/src/SFGUI/Entry.cpp b/src/SFGUI/Entry.cpp index a1153843..ed9aaabf 100644 --- a/src/SFGUI/Entry.cpp +++ b/src/SFGUI/Entry.cpp @@ -10,6 +10,7 @@ namespace sfg { // Signals. Signal::SignalID Entry::OnTextChanged = 0; +Signal::SignalID Entry::OnEnterKeyPressed = 0; Entry::Entry() : m_string(), @@ -179,7 +180,10 @@ void Entry::HandleKeyEvent( sf::Keyboard::Key key, bool press ) { } switch( key ) { - case sf::Keyboard::BackSpace: { // backspace + case sf::Keyboard::Enter: { + GetSignals().Emit( OnEnterKeyPressed ); + } break; + case sf::Keyboard::Backspace: { if( ( m_string.getSize() > 0 ) && ( m_cursor_position > 0 ) ) { m_string.erase( static_cast( m_cursor_position - 1 ) );