- if ( (event.KeyCode() == WXK_RETURN) && (m_windowStyle & wxPROCESS_ENTER))
- {
- wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
- event.SetEventObject( this );
- if ( GetEventHandler()->ProcessEvent(event) )
- return;
- }
- else if ( event.KeyCode() == WXK_TAB ) {
- wxNavigationKeyEvent event;
- event.SetDirection(!(::GetKeyState(VK_SHIFT) & 0x100));
- event.SetWindowChange(FALSE);
- event.SetEventObject(this);
-
- if ( GetEventHandler()->ProcessEvent(event) )
- return;
- }
-
- event.Skip();
+ switch( event.KeyCode() )
+ {
+ // Fix by Marcel Rasche to allow Alt-Ctrl insertion of special characters
+ case '{':
+ case '}':
+ case '[':
+ case ']':
+ case '|':
+ case '~':
+ case '\\':
+ {
+ char c = (char)event.KeyCode();
+ *this << c;
+ }
+ break;
+
+ case WXK_RETURN:
+ wxASSERT_MSG( m_windowStyle & wxTE_PROCESS_ENTER,
+ "this text ctrl should never receive return" );
+ if ( m_windowStyle & wxTE_MULTILINE == 0 )
+ {
+ wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
+ event.SetEventObject( this );
+ if ( GetEventHandler()->ProcessEvent(event) )
+ return;
+ }
+ //else: multiline controls need Enter for themselves
+
+ break;
+
+ case WXK_TAB:
+ // only produce navigation event if we don't process TAB ourself or
+ // if it's a Shift-Tab keypress (we assume nobody will ever need
+ // this key combo for himself)
+ //
+ // NB: Notice that Ctrl-Tab is handled elsewhere and Alt-Tab is
+ // handled by Windows
+ if ( event.ShiftDown() || !(m_windowStyle & wxTE_PROCESS_TAB) )
+ {
+ wxNavigationKeyEvent eventNav;
+ eventNav.SetDirection(!event.ShiftDown());
+ eventNav.SetWindowChange(FALSE);
+ eventNav.SetEventObject(this);
+
+ if ( GetEventHandler()->ProcessEvent(eventNav) )
+ return;
+ }
+ break;
+ }
+
+ // don't just call event.Skip() because this will cause TABs and ENTERs
+ // be passed upwards and we don't always want this - instead process it
+ // right here
+ //Default();
+ event.Skip();