+// TestDefaultAction
+
+#define ID_CATCH_LISTBOX_DCLICK 100
+#define ID_LISTBOX 101
+
+BEGIN_EVENT_TABLE(TestDefaultActionDialog, wxDialog)
+ EVT_CHECKBOX(ID_CATCH_LISTBOX_DCLICK, TestDefaultActionDialog::OnCatchListBoxDClick)
+ EVT_LISTBOX_DCLICK(ID_LISTBOX, TestDefaultActionDialog::OnListBoxDClick)
+END_EVENT_TABLE()
+
+TestDefaultActionDialog::TestDefaultActionDialog( wxWindow *parent ) :
+ wxDialog( parent, -1, "Test default action" )
+{
+ m_catchListBoxDClick = false;
+
+ wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
+
+ wxFlexGridSizer *grid_sizer = new wxFlexGridSizer( 2, 5, 5 );
+
+ wxListBox *listbox = new wxListBox( this, ID_LISTBOX );
+ listbox->Append( "String 1" );
+ listbox->Append( "String 2" );
+ listbox->Append( "String 3" );
+ listbox->Append( "String 4" );
+ grid_sizer->Add( listbox );
+
+ grid_sizer->Add( new wxCheckBox( this, ID_CATCH_LISTBOX_DCLICK, "Catch DoubleClick from wxListBox" ), 0, wxALIGN_CENTRE_VERTICAL );
+
+ grid_sizer->Add( new wxTextCtrl( this, -1, "", wxDefaultPosition, wxSize(80,-1), 0 ), 0, wxALIGN_CENTRE_VERTICAL );
+ grid_sizer->Add( new wxStaticText( this, -1, "wxTextCtrl without wxTE_PROCESS_ENTER" ), 0, wxALIGN_CENTRE_VERTICAL );
+
+ grid_sizer->Add( new wxTextCtrl( this, -1, "", wxDefaultPosition, wxSize(80,-1), wxTE_PROCESS_ENTER ), 0, wxALIGN_CENTRE_VERTICAL );
+ grid_sizer->Add( new wxStaticText( this, -1, "wxTextCtrl with wxTE_PROCESS_ENTER" ), 0, wxALIGN_CENTRE_VERTICAL );
+
+ main_sizer->Add( grid_sizer, 0, wxALL, 10 );
+
+ wxSizer *button_sizer = CreateSeparatedButtonSizer( wxOK|wxCANCEL );
+ if (button_sizer)
+ main_sizer->Add( button_sizer, 0, wxALL|wxGROW, 5 );
+
+ SetSizer( main_sizer );
+ main_sizer->SetSizeHints( this );
+}
+
+void TestDefaultActionDialog::OnListBoxDClick(wxCommandEvent& event)
+{
+ event.Skip( !m_catchListBoxDClick );
+}
+
+void TestDefaultActionDialog::OnCatchListBoxDClick(wxCommandEvent& WXUNUSED(event))
+{
+ m_catchListBoxDClick = !m_catchListBoxDClick;
+}
+
+void MyFrame::OnTestDefaultActionDialog(wxCommandEvent& WXUNUSED(event))
+{
+ TestDefaultActionDialog dialog( this );
+ dialog.ShowModal();
+}
+