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
This commit is contained in:
Robert Roebling 2004-03-01 22:42:07 +00:00
parent ae7cbd1a1f
commit 055e633de6
4 changed files with 12 additions and 8 deletions

View File

@ -271,7 +271,7 @@ void wxSpinCtrl::OnChar( wxKeyEvent &event )
if (event.GetKeyCode() == WXK_RETURN) if (event.GetKeyCode() == WXK_RETURN)
{ {
wxWindow *top_frame = m_parent; 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(); top_frame = top_frame->GetParent();
if ( GTK_IS_WINDOW(top_frame->m_widget) ) if ( GTK_IS_WINDOW(top_frame->m_widget) )
@ -281,7 +281,7 @@ void wxSpinCtrl::OnChar( wxKeyEvent &event )
{ {
GtkWidget *widgetDef = window->default_widget; GtkWidget *widgetDef = window->default_widget;
if ( widgetDef && GTK_IS_WINDOW(widgetDef) ) if ( widgetDef )
{ {
gtk_widget_activate(widgetDef); gtk_widget_activate(widgetDef);
return; return;

View File

@ -310,6 +310,8 @@ bool wxTextCtrl::Create( wxWindow *parent,
if (!HasFlag(wxNO_BORDER)) if (!HasFlag(wxNO_BORDER))
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
#else #else
// create our control ... // create our control ...
m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL ); m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
@ -443,8 +445,8 @@ bool wxTextCtrl::Create( wxWindow *parent,
else else
#endif #endif
{ {
gtk_signal_connect( GTK_OBJECT(m_text), "changed", gtk_signal_connect( GTK_OBJECT(m_text), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
} }
// we don't set a valid background colour, because the window // we don't set a valid background colour, because the window

View File

@ -271,7 +271,7 @@ void wxSpinCtrl::OnChar( wxKeyEvent &event )
if (event.GetKeyCode() == WXK_RETURN) if (event.GetKeyCode() == WXK_RETURN)
{ {
wxWindow *top_frame = m_parent; 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(); top_frame = top_frame->GetParent();
if ( GTK_IS_WINDOW(top_frame->m_widget) ) if ( GTK_IS_WINDOW(top_frame->m_widget) )
@ -281,7 +281,7 @@ void wxSpinCtrl::OnChar( wxKeyEvent &event )
{ {
GtkWidget *widgetDef = window->default_widget; GtkWidget *widgetDef = window->default_widget;
if ( widgetDef && GTK_IS_WINDOW(widgetDef) ) if ( widgetDef )
{ {
gtk_widget_activate(widgetDef); gtk_widget_activate(widgetDef);
return; return;

View File

@ -310,6 +310,8 @@ bool wxTextCtrl::Create( wxWindow *parent,
if (!HasFlag(wxNO_BORDER)) if (!HasFlag(wxNO_BORDER))
gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN ); gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
#else #else
// create our control ... // create our control ...
m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL ); m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
@ -443,8 +445,8 @@ bool wxTextCtrl::Create( wxWindow *parent,
else else
#endif #endif
{ {
gtk_signal_connect( GTK_OBJECT(m_text), "changed", gtk_signal_connect( GTK_OBJECT(m_text), "changed",
GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this); GTK_SIGNAL_FUNC(gtk_text_changed_callback), (gpointer)this);
} }
// we don't set a valid background colour, because the window // we don't set a valid background colour, because the window