5
votes

I'm trying to trigger an event after resizing a column in a TListView set to ViewStyle = vsReport.

Specifically I have two ListViews which I want to keep the columns the same width. Only one listView has column headings, so the event needs to be linked to these.

Poking around at the available procedures for TListViews, there seems to be no relevant options...

Any help?

1
Cheers - hadn't thought that OnCustomDraw would do it. Drop this as an answer and I'll accept - Dan Kelly
No no, use what Remy posted there. You should track HDN_ITEMCHANGED notification. - TLama
I was rather thinking of Remy's solution. Remy should post the answer if he wishes. - kobik

1 Answers

8
votes

Subclass the ListView and intercept WM_NOTIFY messages that are sent from the ListView's header control to the ListView, looking for HDN_ENDTRACK and HDN_ITEMCHANGED notifications.

Not to be confused with CN_NOTIFY messages, which are WM_NOTIFY messages that the ListView sends to itself.