I would like to know as I can modify the order of the
columns of my list. I am using the code:
void CB1::OnButTest()
{
CHeaderCtrl* pHeaderCtrl = m_Grid.GetHeaderCtrl();
if (pHeaderCtrl != NULL)
{
int nColumnCount = pHeaderCtrl-
>GetItemCount();
LPINT pnOrder = (LPINT) malloc
(nColumnCount*sizeof(int));
ASSERT(pnOrder != NULL);
m_Grid.GetColumnOrderArray(pnOrder,
nColumnCount);
int i, nTemp;
for (i=1; i<5; i++)
{
if (i==1)
nTemp = pnOrder[i];
pnOrder[i] = pnOrder[i+1];
}
pnOrder[5] = nTemp;
m_Grid.SetColumnOrderArray(nColumnCount,
pnOrder);
free(pnOrder);
}
}
... and the column of list are:
m_Grid.InsertColumn(0, (LPCTSTR) _T("Produto"),
LVCFMT_LEFT, 100);
m_Grid.InsertColumn(1, (LPCTSTR) _T("Qtde"),
LVCFMT_LEFT, 60);
m_Grid.InsertColumn(2, (LPCTSTR) _T("Pr. Cx."),
LVCFMT_LEFT, 60);
m_Grid.InsertColumn(3, (LPCTSTR) _T("Pr. Un."),
LVCFMT_LEFT, 60);
m_Grid.InsertColumn(4, (LPCTSTR) _T("Prazo"),
LVCFMT_LEFT, 60);
m_Grid.InsertColumn(5, (LPCTSTR) _T("Subtotal"),
LVCFMT_LEFT, 60);
But only the titulos are being changed of place, with this
the content of the columns continue in the same place. I
would like to modify the positioning of the column with
its titulo and fields.
Can you help-me?