changed key handling to new carbon-savvy implementation

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15913 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor 2002-06-21 16:10:34 +00:00
parent ac2d1ca6c6
commit 45c8d9e52a
2 changed files with 18 additions and 22 deletions

View File

@ -353,7 +353,7 @@ static pascal ControlPartCode TPPaneKeyDownProc(ControlHandle theControl,
memset( &ev , 0 , sizeof( ev ) ) ;
ev.what = keyDown ;
ev.modifiers = modifiers ;
ev.message = (( keyCode & keyCodeMask ) << 8 ) + ( charCode & charCodeMask ) ;
ev.message = (( keyCode << 8 ) & keyCodeMask ) + ( charCode & charCodeMask ) ;
TXNKeyDown( (**tpvars).fTXNRec, &ev);
}
}
@ -518,7 +518,7 @@ OSStatus mUPOpenControl(ControlHandle theControl, bool multiline)
( multiline ? kTXNWantVScrollBarMask : 0 ) |
kTXNDontDrawCaretWhenInactiveMask |
kTXNDontDrawSelectionWhenInactiveMask |
kTXNAlwaysWrapAtViewEdgeMask,
kTXNAlwaysWrapAtViewEdgeMask ,
kTXNTextEditStyleFrameType,
kTXNTextensionFile,
kTXNSystemDefaultEncoding,
@ -1331,22 +1331,20 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
break;
}
EventRecord *ev = (EventRecord*) wxTheApp->MacGetCurrentEvent();
short keychar = short(ev->message & charCodeMask);
if (!eat_key)
{
short keycode = short(ev->message & keyCodeMask) >> 8 ;
::HandleControlKey( (ControlHandle) m_macControl , keycode , keychar , ev->modifiers );
// default handling
event.Skip() ;
}
if ( keychar >= 0x20 ||
event.KeyCode() == WXK_RETURN ||
event.KeyCode() == WXK_DELETE ||
event.KeyCode() == WXK_BACK)
if ( key >= 0x20 ||
key == WXK_RETURN ||
key == WXK_DELETE ||
key == WXK_BACK)
{
wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
event1.SetString( GetValue() ) ;
event1.SetEventObject( this );
GetEventHandler()->ProcessEvent(event1);
wxPostEvent(GetEventHandler(),event1);
}
}

View File

@ -353,7 +353,7 @@ static pascal ControlPartCode TPPaneKeyDownProc(ControlHandle theControl,
memset( &ev , 0 , sizeof( ev ) ) ;
ev.what = keyDown ;
ev.modifiers = modifiers ;
ev.message = (( keyCode & keyCodeMask ) << 8 ) + ( charCode & charCodeMask ) ;
ev.message = (( keyCode << 8 ) & keyCodeMask ) + ( charCode & charCodeMask ) ;
TXNKeyDown( (**tpvars).fTXNRec, &ev);
}
}
@ -518,7 +518,7 @@ OSStatus mUPOpenControl(ControlHandle theControl, bool multiline)
( multiline ? kTXNWantVScrollBarMask : 0 ) |
kTXNDontDrawCaretWhenInactiveMask |
kTXNDontDrawSelectionWhenInactiveMask |
kTXNAlwaysWrapAtViewEdgeMask,
kTXNAlwaysWrapAtViewEdgeMask ,
kTXNTextEditStyleFrameType,
kTXNTextensionFile,
kTXNSystemDefaultEncoding,
@ -1331,22 +1331,20 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
break;
}
EventRecord *ev = (EventRecord*) wxTheApp->MacGetCurrentEvent();
short keychar = short(ev->message & charCodeMask);
if (!eat_key)
{
short keycode = short(ev->message & keyCodeMask) >> 8 ;
::HandleControlKey( (ControlHandle) m_macControl , keycode , keychar , ev->modifiers );
// default handling
event.Skip() ;
}
if ( keychar >= 0x20 ||
event.KeyCode() == WXK_RETURN ||
event.KeyCode() == WXK_DELETE ||
event.KeyCode() == WXK_BACK)
if ( key >= 0x20 ||
key == WXK_RETURN ||
key == WXK_DELETE ||
key == WXK_BACK)
{
wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
event1.SetString( GetValue() ) ;
event1.SetEventObject( this );
GetEventHandler()->ProcessEvent(event1);
wxPostEvent(GetEventHandler(),event1);
}
}