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.
Closes #14930.
(this is a backport of 8e0799e3e5
from master)
This commit is contained in:
@@ -640,6 +640,7 @@ wxOSX:
|
||||
- Fix handling of "Cancel" button in wxSearchCtrl (John Roberts).
|
||||
- Generate correct events for WXK_NUMPAD_ENTER (John Roberts).
|
||||
- Fix handling of WXK_NUMPAD_ENTER in wxTextCtrl (John Roberts).
|
||||
- Generate wxEVT_TEXT_ENTER for wxTE_PASSWORD controls too (mj_smoker).
|
||||
- Send wxIconizeEvent when a window is iconized/restore (Rob Krakora).
|
||||
- Use correct colour for disabled wxStaticText (sbrowne).
|
||||
- Fix printing all pages non-interactively (John Roberts).
|
||||
|
@@ -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