]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/textctrl.cpp
fixes for big endiand machines (Chris Elliott, patch 520879)
[wxWidgets.git] / src / gtk / textctrl.cpp
index 6c37c6636ac42b8c054524fa27eaa063965066af..8dff685433d179120daa1479f3e8dbddb5362fe4 100644 (file)
@@ -964,15 +964,22 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
 
     if ((key_event.KeyCode() == WXK_RETURN) && !(m_windowStyle & wxTE_MULTILINE))
     {
+        // This will invoke the dialog default action, such
+        // as the clicking the default button.
+    
         wxWindow *top_frame = m_parent;
         while (top_frame->GetParent() && !(top_frame->IsTopLevel()))
             top_frame = top_frame->GetParent();
-        GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
-
-        if (window->default_widget)
+        
+        if (top_frame && GTK_IS_WINDOW(top_frame->m_widget))
         {
-            gtk_widget_activate (window->default_widget);
-            return;
+            GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
+
+            if (window->default_widget)
+            {
+                gtk_widget_activate (window->default_widget);
+                return;
+            }
         }
     }
 
@@ -997,7 +1004,7 @@ bool wxTextCtrl::SetFont( const wxFont &font )
 {
     wxCHECK_MSG( m_text != NULL, FALSE, wxT("invalid text ctrl") );
 
-    if ( !wxWindowBase::SetFont(font) )
+    if ( !wxTextCtrlBase::SetFont(font) )
     {
         // font didn't change, nothing to do
         return FALSE;