开发者

Sorting a listview (Win32/C++)

I'm trying to sort a listview when the user clicks on the column header.

I am catching the LVN_COLUMNCLICK notification like so:

  ca开发者_如何学Gose LVN_COLUMNCLICK:
  {
     NMLISTVIEW*    pListView   = (NMLISTVIEW*)lParam;
     BOOL test = ListView_SortItems ( m_hDuplicateObjectsList, ListViewCompareProc, pListView->iSubItem );
     break;
  }

However it seems to fail. My test variable is FALSE and my ListViewCompareProc never gets hit (it has a simple return 1 while I am trying to hit a debug point inside of it).

Is there something I am missing for sorting a listview?


Are you using the LVS_OWNERDATA style on your control?

There are a number of features incompatible with that style, including sorting:

http://msdn.microsoft.com/en-us/library/bb774735%28VS.85%29.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜