From 66cf613e7bfe6d59b531a6d909a8f4286aef6e06 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 4 Nov 2002 22:25:55 +0000 Subject: [PATCH] show column width in the column event handlers git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17708 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/listctrl/listtest.cpp | 17 ++++++++++++++--- samples/listctrl/listtest.h | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp index 31eccdbffd..3777ac5c16 100644 --- a/samples/listctrl/listtest.cpp +++ b/samples/listctrl/listtest.cpp @@ -661,19 +661,30 @@ void MyListCtrl::OnColRightClick(wxListEvent& event) wxLogMessage( wxT("OnColumnRightClick at %d."), event.GetColumn() ); } +void MyListCtrl::LogColEvent(const wxListEvent& event, const wxChar *name) +{ + const int col = event.GetColumn(); + + wxLogMessage(wxT("%s: column %d (width = %d or %d)."), + name, + col, + event.GetItem().GetWidth(), + GetColumnWidth(col)); +} + void MyListCtrl::OnColBeginDrag(wxListEvent& event) { - wxLogMessage( wxT("OnColBeginDrag: column %d."), event.GetColumn() ); + LogColEvent( event, wxT("OnColBeginDrag") ); } void MyListCtrl::OnColDragging(wxListEvent& event) { - wxLogMessage( wxT("OnColDragging: column %d."), event.GetColumn() ); + LogColEvent( event, wxT("OnColDragging") ); } void MyListCtrl::OnColEndDrag(wxListEvent& event) { - wxLogMessage( wxT("OnColEndDrag: column %d."), event.GetColumn() ); + LogColEvent( event, wxT("OnColEndDrag") ); } void MyListCtrl::OnBeginDrag(wxListEvent& event) diff --git a/samples/listctrl/listtest.h b/samples/listctrl/listtest.h index 22bb8eaaba..a86724980d 100644 --- a/samples/listctrl/listtest.h +++ b/samples/listctrl/listtest.h @@ -58,6 +58,7 @@ private: void SetColumnImage(int col, int image); void LogEvent(const wxListEvent& event, const wxChar *eventName); + void LogColEvent(const wxListEvent& event, const wxChar *eventName); virtual wxString OnGetItemText(long item, long column) const; virtual int OnGetItemImage(long item) const;