]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/textctrl.mm
guarding open combo box against AppDefined NSEvents issued by wxEventLoop::WakeUp...
[wxWidgets.git] / src / osx / cocoa / textctrl.mm
index 3099d4a408c13ada1d3648105757d8cdad3e3565..760257f4f4547e0afa9139dd416ca4331cf1fe1d 100644 (file)
@@ -148,7 +148,7 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
     int len = [*partialStringPtr length];
     if ( maxLength > 0 && len > maxLength )
     {
     int len = [*partialStringPtr length];
     if ( maxLength > 0 && len > maxLength )
     {
-        // TODO wxEVT_COMMAND_TEXT_MAXLEN
+        // TODO wxEVT_TEXT_MAXLEN
         return NO;
     }
     return YES;
         return NO;
     }
     return YES;
@@ -182,7 +182,11 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
     wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
     if ( impl )
     {
     wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
     if ( impl )
     {
-        impl->DoNotifyFocusEvent( false, NULL );
+        NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder();
+        NSView* otherView = wxOSXGetViewFromResponder(responder);
+        
+        wxWidgetImpl* otherWindow = impl->FindBestFromWXWidget(otherView);
+        impl->DoNotifyFocusEvent( false, otherWindow );
     }
 }
 
     }
 }
 
@@ -206,7 +210,7 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
                     wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
                     if ( def && def->IsEnabled() )
                     {
                     wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
                     if ( def && def->IsEnabled() )
                     {
-                        wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
+                        wxCommandEvent event(wxEVT_BUTTON, def->GetId() );
                         event.SetEventObject(def);
                         def->Command(event);
                         handled = YES;
                         event.SetEventObject(def);
                         def->Command(event);
                         handled = YES;
@@ -336,7 +340,11 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
     wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
     if ( impl )
     {
     wxWidgetCocoaImpl* impl = (wxWidgetCocoaImpl* ) wxWidgetImpl::FindFromWXWidget( self );
     if ( impl )
     {
-        impl->DoNotifyFocusEvent( false, NULL );
+        NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder();
+        NSView* otherView = wxOSXGetViewFromResponder(responder);
+        
+        wxWidgetImpl* otherWindow = impl->FindBestFromWXWidget(otherView);
+        impl->DoNotifyFocusEvent( false, otherWindow );
     }
 }
 
     }
 }
 
@@ -506,7 +514,11 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
             timpl->SetInternalSelection(range.location, range.location + range.length);
         }
 
             timpl->SetInternalSelection(range.location, range.location + range.length);
         }
 
-        impl->DoNotifyFocusEvent( false, NULL );
+        NSResponder * responder = wxNonOwnedWindowCocoaImpl::GetNextFirstResponder();
+        NSView* otherView = wxOSXGetViewFromResponder(responder);
+        
+        wxWidgetImpl* otherWindow = impl->FindBestFromWXWidget(otherView);
+        impl->DoNotifyFocusEvent( false, otherWindow );
     }
 }
 @end
     }
 }
 @end
@@ -912,7 +924,7 @@ void wxNSTextFieldControl::controlAction(WXWidget WXUNUSED(slf),
     wxWindow* wxpeer = (wxWindow*) GetWXPeer();
     if ( wxpeer && (wxpeer->GetWindowStyle() & wxTE_PROCESS_ENTER) )
     {
     wxWindow* wxpeer = (wxWindow*) GetWXPeer();
     if ( wxpeer && (wxpeer->GetWindowStyle() & wxTE_PROCESS_ENTER) )
     {
-        wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, wxpeer->GetId());
+        wxCommandEvent event(wxEVT_TEXT_ENTER, wxpeer->GetId());
         event.SetEventObject( wxpeer );
         event.SetString( GetTextEntry()->GetValue() );
         wxpeer->HandleWindowEvent( event );
         event.SetEventObject( wxpeer );
         event.SetString( GetTextEntry()->GetValue() );
         wxpeer->HandleWindowEvent( event );