+void wxSpinCtrl::OnChar( wxKeyEvent &event )
+{
+ wxCHECK_RET( m_widget != NULL, wxT("invalid spin ctrl") );
+
+ if (event.GetKeyCode() == WXK_RETURN)
+ {
+ wxWindow *top_frame = m_parent;
+ while (top_frame->GetParent() && !(top_frame->IsTopLevel()))
+ top_frame = top_frame->GetParent();
+
+ if ( GTK_IS_WINDOW(top_frame->m_widget) )
+ {
+ GtkWindow *window = GTK_WINDOW(top_frame->m_widget);
+ if ( window )
+ {
+ GtkWidget *widgetDef = window->default_widget;
+
+ if ( widgetDef )
+ {
+ gtk_widget_activate(widgetDef);
+ return;
+ }
+ }
+ }
+ }
+
+ if ((event.GetKeyCode() == WXK_RETURN) && (m_windowStyle & wxPROCESS_ENTER))
+ {
+ wxCommandEvent evt( wxEVT_COMMAND_TEXT_ENTER, m_windowId );
+ evt.SetEventObject(this);
+ GtkSpinButton *gsb = GTK_SPIN_BUTTON(m_widget);
+ wxString val = wxGTK_CONV_BACK( gtk_entry_get_text( &gsb->entry ) );
+ evt.SetString( val );
+ if (GetEventHandler()->ProcessEvent(evt)) return;
+ }
+
+ event.Skip();
+}
+