Click here to Skip to main content
15,895,798 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have developed an SDI application in VC++ for displaying a text file in tree view (left side) and list view (right side). Now i want to make the list view editable. i want to edit each cell in the list view.Can any one please help me out or suggest something how to proceed. Thanks in advance. And below is the part of my code.

For tokenising and parsing the string:

C++
void CLeftView::OnFileOpen()
{
	// TODO: Add your command handler code here

	CTreeCtrl&  trCtrl = GetTreeCtrl(); 
    HTREEITEM hItem,hsc; 

                 
    CString pathname,strLine; 
    CString filename;
    CFileDialog dlg(TRUE);
    dlg.DoModal();
    if(dlg.DoModal() == IDOK)
    {
         pathname=dlg.GetPathName(); // return full path and filename
    }

          
    CStdioFile File;

    if(File.Open(pathname, CFile::modeRead)) // Open file to be read 
    { 
             
         while(File.ReadString(strLine)) // Read file 
              { 
                     int Position = 0; 
                     CString Token; 

                     CAtlString str(strLine);
                     CAtlString resToken,resToken1;

                     resToken = str.Tokenize(_T("-:, "), Position);
                     if(resToken != (_T(""))) // Empty File Check
                     hItem = trCtrl.InsertItem(resToken , 0, 2 );

              
                     while(resToken!="") 
                     { 
                           _tprintf_s(_T("Token: %s\n"), resToken);
                           resToken = str.Tokenize(_T("-:, "), Position); 
                                         
                           hsc = trCtrl.InsertItem(resToken , 0, 2 ,hItem);

                           resToken = str.Tokenize(_T("-:, "), Position);
                                            
                           trCtrl.InsertItem(resToken , 0, 2 ,hsc);

                           resToken = str.Tokenize(_T("-:, "), Position);
                                            
                           trCtrl.InsertItem(resToken , 0, 2 ,hsc);
       
                     } 
              } 
       }
Posted
Updated 4-Apr-13 20:15pm
v3

1 solution

Please don't repost the same question; edit your original.
 
Share this answer
 
Comments
H.Brydon 3-Apr-13 11:25am    
??? - this is a solution?
You did just as bad here as what you are advising against.
Richard MacCutchan 3-Apr-13 11:51am    
What?
H.Brydon 3-Apr-13 13:50pm    
You posted a non-solution as Solution 1, telling OP not to mis-use the system.
Richard MacCutchan 3-Apr-13 15:15pm    
It's added as a solution to remove it from the unanswered queue; which is the generally accepted way here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900