Listview - Set and Retrieve Column Position

Started by Rolf Brandt, February 18, 2010, 01:46:44 PM

Previous topic - Next topic

Rolf Brandt

Scenario:
A Listview with Header DragDrop, the user changes the order of columns. The order of columns should be saved and restored.

Question:
How can I retrieve the position of the column, and how can it be set programatically?
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

José Roca

To get the current left-to-right order of columns:


DIM lpiArray(iCount - 1) AS LONG
SendMessage(hwndLV, %LVM_GETCOLUMNORDERARRAY, iCount, VARPTR(lpiArray(0)))


Where iCount is the number of columns and hwndLV the handle of the ListView.

To set the left-to-right order of columns use:


SendMessage(hwndLV, %LVM_SETCOLUMNORDERARRAY, iCount, VARPTR(lpiArray(0)))


Rolf Brandt

Thank you, Jose. I was just checking through your wrappers in ListViewCtrl.inc and found

ListView_GetColumnOrderArray.

Thanks for the quick help.
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Rolf Brandt

Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)