Handle wxTE_PROCESS_ENTER with wxTE_PASSWORD correctly in wxOSX.

Controls with wxTE_PASSWORD style didn't send wxEVT_TEXT_ENTER even if they
also had wxTE_PROCESS_ENTER. Fix this by checking for the latter style before
mapping the enter presses to default button activation.

See #14930.
This commit is contained in:
mj_smoker
2015-07-18 01:45:12 +02:00
committed by Vadim Zeitlin
parent c269398588
commit 8e0799e3e5

View File

@@ -212,6 +212,17 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
if ( wxpeer )
{
if (commandSelector == @selector(insertNewline:))
{
if ( wxpeer->GetWindowStyle() & wxTE_PROCESS_ENTER )
{
wxCommandEvent event(wxEVT_TEXT_ENTER, wxpeer->GetId());
event.SetEventObject( wxpeer );
wxTextWidgetImpl* impl = (wxNSTextFieldControl * ) wxWidgetImpl::FindFromWXWidget( self );
wxTextEntry * const entry = impl->GetTextEntry();
event.SetString( entry->GetValue() );
handled = wxpeer->HandleWindowEvent( event );
}
else
{
wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(wxpeer), wxTopLevelWindow);
if ( tlw && tlw->GetDefaultItem() )
@@ -228,6 +239,7 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
}
}
}
}
return handled;
}