From 60f7ea223712d1025b185068054c4ab7cfbf03d2 Mon Sep 17 00:00:00 2001 From: Jaakko Salli Date: Sun, 5 Oct 2008 17:40:53 +0000 Subject: [PATCH] Better use of Connect() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56094 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/propgrid/advprops.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index 71a57d4cb1..145e1774d1 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -142,15 +142,13 @@ wxPGWindowList wxPGSpinCtrlEditor::CreateControls( wxPropertyGrid* propgrid, wxP wnd2->SetRange( INT_MIN, INT_MAX ); wnd2->SetValue( 0 ); - propgrid->Connect( wxPG_SUBID2, wxEVT_SCROLL_LINEUP, - (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) - &wxPropertyGrid::OnCustomEditorEvent, NULL, propgrid ); - propgrid->Connect( wxPG_SUBID2, wxEVT_SCROLL_LINEDOWN, - (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) - &wxPropertyGrid::OnCustomEditorEvent, NULL, propgrid ); - propgrid->Connect( wxPG_SUBID1, wxEVT_KEY_DOWN, - (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) - &wxPropertyGrid::OnCustomEditorEvent, NULL, propgrid ); + wxWindowID id = wnd2->GetId(); + wnd2->Connect( id, wxEVT_SCROLL_LINEUP, + wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent), + NULL, propgrid ); + wnd2->Connect( id, wxEVT_SCROLL_LINEDOWN, + wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent), + NULL, propgrid ); // Let's add validator to make sure only numbers can be entered wxTextValidator validator(wxFILTER_NUMERIC, &m_tempString); @@ -158,6 +156,10 @@ wxPGWindowList wxPGSpinCtrlEditor::CreateControls( wxPropertyGrid* propgrid, wxP wxTextCtrl* wnd1 = (wxTextCtrl*) wxPGTextCtrlEditor::CreateControls( propgrid, property, pos, tcSz ).m_primary; wnd1->SetValidator(validator); + wnd1->Connect( wnd1->GetId(), wxEVT_KEY_DOWN, + wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent), + NULL, propgrid ); + return wxPGWindowList(wnd1, wnd2); } @@ -335,9 +337,9 @@ wxPGWindowList wxPGDatePickerCtrlEditor::CreateControls( wxPropertyGrid* propgri // Connect all required events to grid's OnCustomEditorEvent // (all relevenat wxTextCtrl, wxComboBox and wxButton events are // already connected) - propgrid->Connect( wxPG_SUBID1, wxEVT_DATE_CHANGED, - (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) - &wxPropertyGrid::OnCustomEditorEvent ); + ctrl->Connect( wxPG_SUBID1, wxEVT_DATE_CHANGED, + wxCommandEventHandler(wxPropertyGrid::OnCustomEditorEvent), + NULL, propgrid ); #ifdef __WXMSW__ ctrl->Show();