July 21st, 2004, 10:05 AM
have you even run into problem like this?
Just use a listctrl in my view, and when I insert item like this, the data won't be able to display multiple rows of data correctly
there are several item block has no text displayed in the listctrl at all.
but if you change format line into
by adding an extra space in front of the %s, it will work. Wondering why...
July 21st, 2004, 10:26 AM
It looks like your problem is in sorting style of your list control.
Either change this style to NONE (in resource editor)
or (the best way for you)
correct your code:
int iItem = this->m_ListCtrl.InsertItem(i,name,0);
if(iItem > -1)
July 21st, 2004, 11:19 AM
A few things:
- Why are you using this-> when accessing m_ListCtrl? You don't need that, just write m_ListCtrl.
- Why are you using Format("%s") to assign a string to another? Just assign it with s = name. To add a blank, write s = " " + name;
- When adding an item with InsertItem(), you can specify an item index. However, this is just a request, it is not guaranteed that the item will be inserted at that position. That's why InsertItem() returns the actual item index, and you should use that in your call to SetItemText(), not your original index. Especially when the list control is sorted, the index will differ from the one you supplied, so I suspect that this is your actual problem.
July 21st, 2004, 06:36 PM
habit from Java
I just thinking java when programming in VC, so that's why I like to use this pointer to avoid ambiguity.
no point using format , but I am just curious.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!