From: Robert Roebling Date: Mon, 1 Mar 2004 22:42:07 +0000 (+0000) Subject: Make multi-line text control focussable X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/055e633de60a9f08d5d4f9826c323d280fb46085 Make multi-line text control focussable by using tabs under GTK 2.0. Make hitting ENTER in a wxSpinCtrl to activate the default button work. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26018 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index ff4ee9faeb..b1d33df231 100644 --- a/src/gtk/spinctrl.cpp +++ b/src/gtk/spinctrl.cpp @@ -271,7 +271,7 @@ void wxSpinCtrl::OnChar( wxKeyEvent &event ) if (event.GetKeyCode() == WXK_RETURN) { wxWindow *top_frame = m_parent; - while (top_frame->GetParent() && !(top_frame->GetParent()->IsTopLevel())) + while (top_frame->GetParent() && !(top_frame->IsTopLevel())) top_frame = top_frame->GetParent(); if ( GTK_IS_WINDOW(top_frame->m_widget) ) @@ -281,7 +281,7 @@ void wxSpinCtrl::OnChar( wxKeyEvent &event ) { GtkWidget *widgetDef = window->default_widget; - if ( widgetDef && GTK_IS_WINDOW(widgetDef) ) + if ( widgetDef ) { gtk_widget_activate(widgetDef); return; diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 79726b054c..648fdab6a5 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -310,6 +310,8 @@ bool wxTextCtrl::Create( wxWindow *parent, if (!HasFlag(wxNO_BORDER)) gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN ); + + GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); #else // create our control ... m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL ); @@ -443,8 +445,8 @@ bool wxTextCtrl::Create( wxWindow *parent, else #endif { - gtk_signal_connect( GTK_OBJECT(m_text), "changed", - GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); + gtk_signal_connect( GTK_OBJECT(m_text), "changed", + GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); } // we don't set a valid background colour, because the window diff --git a/src/gtk1/spinctrl.cpp b/src/gtk1/spinctrl.cpp index ff4ee9faeb..b1d33df231 100644 --- a/src/gtk1/spinctrl.cpp +++ b/src/gtk1/spinctrl.cpp @@ -271,7 +271,7 @@ void wxSpinCtrl::OnChar( wxKeyEvent &event ) if (event.GetKeyCode() == WXK_RETURN) { wxWindow *top_frame = m_parent; - while (top_frame->GetParent() && !(top_frame->GetParent()->IsTopLevel())) + while (top_frame->GetParent() && !(top_frame->IsTopLevel())) top_frame = top_frame->GetParent(); if ( GTK_IS_WINDOW(top_frame->m_widget) ) @@ -281,7 +281,7 @@ void wxSpinCtrl::OnChar( wxKeyEvent &event ) { GtkWidget *widgetDef = window->default_widget; - if ( widgetDef && GTK_IS_WINDOW(widgetDef) ) + if ( widgetDef ) { gtk_widget_activate(widgetDef); return; diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 79726b054c..648fdab6a5 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -310,6 +310,8 @@ bool wxTextCtrl::Create( wxWindow *parent, if (!HasFlag(wxNO_BORDER)) gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN ); + + GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); #else // create our control ... m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL ); @@ -443,8 +445,8 @@ bool wxTextCtrl::Create( wxWindow *parent, else #endif { - gtk_signal_connect( GTK_OBJECT(m_text), "changed", - GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); + gtk_signal_connect( GTK_OBJECT(m_text), "changed", + GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); } // we don't set a valid background colour, because the window