I.You

Hi.

For example,

for(i=0; i<n; i++) {

...

XXX.InsertItem(0, A); // CListCtrl XXXClass::XXX

XXX.SetItemText(0, 1, B);

XXX.SetItemText(0, 2, C);

XXX.SetItemText(0, 3, D);

...

}

I could get the result of list, but it's reversed, i.e. last-in first-out.

I want like this:

A B C D

i=0

i=1

i=2

...

What's wrong

Sorry for this simple matter...



Re: Visual C++ General sort of CListCtrl

Prasad Somwanshi

for(i=0; i<n; i++) {

...

XXX.InsertItem(0, A); // CListCtrl XXXClass::XXX

You may like this to modify to,

for(i=0; i<n; i++) {

XXX.InsertItem(
LVIF_TEXT|LVIF_STATE, i, "A",
0, LVIS_SELECTED,
0, 0);
// Initialize the text of the subitems.
XXX.SetItemText(i, 1, "B");

XXX.SetItemText(i, 2, "C");

XXX.SetItemText(i, 3, "D");





Re: Visual C++ General sort of CListCtrl

I.You

Thanks a lot, Prasad.

I got it!

I've got a more question.

In order to append some items to that list in another function, how to do

 





Re: Visual C++ General sort of CListCtrl

Prasad Somwanshi

You can follow same method there,too.

Whatch out paremeters of SetItemText.





Re: Visual C++ General sort of CListCtrl

I.You

Thanks a lot, Prasad

OK, very helpful to me.