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:
@@ -213,17 +213,29 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
|
||||
{
|
||||
if (commandSelector == @selector(insertNewline:))
|
||||
{
|
||||
wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(wxpeer), wxTopLevelWindow);
|
||||
if ( tlw && tlw->GetDefaultItem() )
|
||||
if ( wxpeer->GetWindowStyle() & wxTE_PROCESS_ENTER )
|
||||
{
|
||||
wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
|
||||
if ( def && def->IsEnabled() )
|
||||
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() )
|
||||
{
|
||||
wxCommandEvent event(wxEVT_BUTTON, def->GetId() );
|
||||
event.SetEventObject(def);
|
||||
def->Command(event);
|
||||
handled = YES;
|
||||
}
|
||||
wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
|
||||
if ( def && def->IsEnabled() )
|
||||
{
|
||||
wxCommandEvent event(wxEVT_BUTTON, def->GetId() );
|
||||
event.SetEventObject(def);
|
||||
def->Command(event);
|
||||
handled = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user