a simpler fix of textctrl key doubling bug
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2029 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -955,26 +955,8 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
{
|
{
|
||||||
switch( event.KeyCode() )
|
switch( event.KeyCode() )
|
||||||
{
|
{
|
||||||
// VZ: commented out until somebody explains to me what it does
|
|
||||||
#if 0
|
|
||||||
// Fix by Marcel Rasche to allow Alt-Ctrl insertion of special characters
|
|
||||||
case '{':
|
|
||||||
case '}':
|
|
||||||
case '[':
|
|
||||||
case ']':
|
|
||||||
case '|':
|
|
||||||
case '~':
|
|
||||||
case '\\':
|
|
||||||
{
|
|
||||||
char c = (char)event.KeyCode();
|
|
||||||
WriteText(c);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif // 0
|
|
||||||
|
|
||||||
case WXK_RETURN:
|
case WXK_RETURN:
|
||||||
{
|
if ( !(m_windowStyle & wxTE_MULTILINE) )
|
||||||
if ( (m_windowStyle & wxTE_MULTILINE) == 0 )
|
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
|
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
@@ -984,7 +966,6 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
//else: multiline controls need Enter for themselves
|
//else: multiline controls need Enter for themselves
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case WXK_TAB:
|
case WXK_TAB:
|
||||||
// only produce navigation event if we don't process TAB ourself or
|
// only produce navigation event if we don't process TAB ourself or
|
||||||
@@ -1007,6 +988,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't just call event.Skip() because this will cause TABs and ENTERs
|
// don't just call event.Skip() because this will cause TABs and ENTERs
|
||||||
|
@@ -2038,8 +2038,9 @@ long wxWindow::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
|
|
||||||
long wxWindow::Default()
|
long wxWindow::Default()
|
||||||
{
|
{
|
||||||
// Ignore 'fake' events (perhaps generated as a result of a separate real event)
|
// Ignore 'fake' events (perhaps generated as a result of a separate real
|
||||||
if (m_lastMsg == 0)
|
// event)
|
||||||
|
if ( m_lastMsg == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
@@ -2047,18 +2048,13 @@ long wxWindow::Default()
|
|||||||
wxGetMessageName(m_lastMsg));
|
wxGetMessageName(m_lastMsg));
|
||||||
#endif // __WXDEBUG__
|
#endif // __WXDEBUG__
|
||||||
|
|
||||||
long ret = this->MSWDefWindowProc(m_lastMsg, m_lastWParam, m_lastLParam);
|
return MSWDefWindowProc(m_lastMsg, m_lastWParam, m_lastLParam);
|
||||||
|
|
||||||
// The idea here is to prevent MSWDefWindowProc from being called twice,
|
|
||||||
// which it can be where OnChar/OnKeyDown are concerned (because OnChar is
|
|
||||||
// sometimes called in wxWin where it isn't in MSW)
|
|
||||||
m_lastMsg = 0;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
|
bool wxWindow::MSWProcessMessage(WXMSG* pMsg)
|
||||||
{
|
{
|
||||||
if ( m_hWnd != 0 && (GetWindowStyleFlag() & wxTAB_TRAVERSAL) ) {
|
if ( m_hWnd != 0 && (GetWindowStyleFlag() & wxTAB_TRAVERSAL) )
|
||||||
|
{
|
||||||
// intercept dialog navigation keys
|
// intercept dialog navigation keys
|
||||||
MSG *msg = (MSG *)pMsg;
|
MSG *msg = (MSG *)pMsg;
|
||||||
bool bProcess = TRUE;
|
bool bProcess = TRUE;
|
||||||
@@ -3790,17 +3786,7 @@ WXDWORD wxWindow::Determine3DEffects(WXDWORD defaultBorderStyle, bool *want3D)
|
|||||||
|
|
||||||
void wxWindow::OnChar(wxKeyEvent& event)
|
void wxWindow::OnChar(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
bool isVirtual;
|
event.Skip();
|
||||||
int id = wxCharCodeWXToMSW((int)event.KeyCode(), &isVirtual);
|
|
||||||
|
|
||||||
if ( id == -1 )
|
|
||||||
id= m_lastWParam;
|
|
||||||
|
|
||||||
if ( !event.ControlDown() ) // Why this test?
|
|
||||||
{
|
|
||||||
if (m_lastMsg != 0)
|
|
||||||
(void) MSWDefWindowProc(m_lastMsg, (WPARAM) id, m_lastLParam);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindow::OnKeyDown(wxKeyEvent& event)
|
void wxWindow::OnKeyDown(wxKeyEvent& event)
|
||||||
|
Reference in New Issue
Block a user