Click here to Skip to main content
15,905,679 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: MFC/W32 Bitmap/Icon editor in source... Pin
Neville Franks25-Sep-03 11:26
Neville Franks25-Sep-03 11:26 
GeneralAutomated Testing tools for MFC / VC++ application Pin
Member 35909825-Sep-03 8:50
Member 35909825-Sep-03 8:50 
GeneralRe: Automated Testing tools for MFC / VC++ application Pin
David Crow25-Sep-03 8:52
David Crow25-Sep-03 8:52 
GeneralRe: Automated Testing tools for MFC / VC++ application Pin
Joe Woodbury25-Sep-03 18:20
professionalJoe Woodbury25-Sep-03 18:20 
GeneralCD Writing Pin
Member 45104625-Sep-03 8:25
Member 45104625-Sep-03 8:25 
GeneralRe: CD Writing Pin
David Crow25-Sep-03 8:51
David Crow25-Sep-03 8:51 
GeneralRe: CD Writing Pin
Alexander M.,27-Sep-03 12:00
Alexander M.,27-Sep-03 12:00 
GeneralQuestion about CListCtrl Pin
b_girl25-Sep-03 7:19
b_girl25-Sep-03 7:19 
I have a CListCtrl that I'm attempting to add items to. I have followed what it says to do for inserting items in the Using the List Control article by Matt Weagle: http://www.codeproject.com/listctrl/listctrldemo.asp?target=clistctrl%7Creport%7Cview%7Cinsert

I have created 2 columns that I'm attempting to add items to. The first row that I insert does go in the correct place, but when I insert the second row, the item in the first column gets entered into row 0 and the contents of the current row 0 get shifted down to row 1. This wouldn't be a huge problem for me, except that that I enter into the second column, doesn't get inserted into row 0, but goes into row 1, overwriting the current value in row 1. Here's my code so far, if anyone notices any mistakes, please let me know!

CString tempstr, strItem;
CStdioFile browseFile;
LVITEM lvi;
int numRead = browseFile.Read(readBuffer, fileLength);
....
int rowNumber = 0;
//read in/set z and concentration values in CListCtrl, use InsertItem
for (counter = 0; counter < numRead; counter++)
{
tempstr = "";
while((readBuffer[counter] != ' ') && (readBuffer[counter] != '\n') && (counter < numRead))
{
tempstr += readBuffer[counter];
counter++;
}
if(readBuffer[counter] == ' ')
{
//if a space, tempstr is for the first column
lvi.mask = LVIF_TEXT;
strItem.Format(_T(tempstr));
lvi.iItem = rowNumber;
lvi.iSubItem = 0;
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem);
m_elementList.InsertItem(&lvi);
}
else if(readBuffer[counter] == '\n')
{
//if a newline, tempstr is for the second column
strItem.Format(_T(tempstr));
lvi.iSubItem = 1;
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem);
m_elementList.SetItem(&lvi);
//increase the row number
rowNumber++;
}
else if(counter >= numRead)
{
//if the last element in the file, tempstr is for the second column
strItem.Format(_T(tempstr));
lvi.iSubItem = 1;
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem);
m_elementList.SetItem(&lvi);
}
}
GeneralRe: Question about CListCtrl Pin
Michael Dunn25-Sep-03 7:32
sitebuilderMichael Dunn25-Sep-03 7:32 
GeneralRe: Question about CListCtrl Pin
b_girl25-Sep-03 7:39
b_girl25-Sep-03 7:39 
GeneralRe: Question about CListCtrl Pin
vcplusplus25-Sep-03 7:39
vcplusplus25-Sep-03 7:39 
GeneralRe: Question about CListCtrl Pin
b_girl25-Sep-03 7:55
b_girl25-Sep-03 7:55 
GeneralRe: Question about CListCtrl Pin
b_girl25-Sep-03 8:34
b_girl25-Sep-03 8:34 
GeneralRe: Question about CListCtrl Pin
Ravi Bhavnani25-Sep-03 8:38
professionalRavi Bhavnani25-Sep-03 8:38 
GeneralCache draw output Pin
Mathias S.25-Sep-03 6:55
Mathias S.25-Sep-03 6:55 
GeneralRe: Cache draw output Pin
JWood25-Sep-03 8:08
JWood25-Sep-03 8:08 
GeneralRe: Cache draw output Pin
JWood25-Sep-03 8:14
JWood25-Sep-03 8:14 
GeneralBringing an application to the top Pin
MarcoNedwig25-Sep-03 6:37
MarcoNedwig25-Sep-03 6:37 
GeneralRe: Bringing an application to the top Pin
Neville Franks25-Sep-03 7:38
Neville Franks25-Sep-03 7:38 
GeneralRe: Bringing an application to the top Pin
igor196025-Sep-03 8:37
igor196025-Sep-03 8:37 
GeneralRe: Bringing an application to the top Pin
Bo Hunter25-Sep-03 10:12
Bo Hunter25-Sep-03 10:12 
GeneralRe: Bringing an application to the top Pin
igor196025-Sep-03 10:30
igor196025-Sep-03 10:30 
GeneralRe: Bringing an application to the top Pin
igor196025-Sep-03 10:44
igor196025-Sep-03 10:44 
GeneralTree getting grayed Pin
Binayak25-Sep-03 6:29
Binayak25-Sep-03 6:29 
Generalcorruption of comctl32 Pin
JWood25-Sep-03 6:18
JWood25-Sep-03 6:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.