CListCtrl::SetItemText( ) problem 
Author Message
 CListCtrl::SetItemText( ) problem

I can't seem to track down the problem here...
Here is a function I've written that updates items in a ClistCtrl object:

void CMyListyView::InsertToken (const CString& sName, char* szValue, int&
iRow)
{
    CListCtrl& ctlList = GetListCtrl();
    char separator[] = "|"; // tokens are separated by vertical pipe char

    char* token = strtok( szValue, separator );

    while( token != NULL )
    {
        ctlList.InsertItem(iRow, sName);
        ctlList.SetItemText(iRow, 1, token );    // may or may not work?
         token = strtok( NULL, separator );    // Get next token
         iRow++;  // advance row
     }

Quote:
}

I have stepped through the code and verified that the tokens are being
parsed corectly, but to my surprise, on some calls to InsertToken( ) the
SetItemText call will either consistently succeed or consistently fail. By
fail, I mean that no text is changed in the desired cell of the listctrl.

Anybody have any thoughts?

Thanks,
Dean



Sun, 11 Sep 2005 02:23:48 GMT  
 CListCtrl::SetItemText( ) problem
Never mind.  I solved the problem.

Thanks.


Quote:
> I can't seem to track down the problem here...
> Here is a function I've written that updates items in a ClistCtrl object:

> void CMyListyView::InsertToken (const CString& sName, char* szValue, int&
> iRow)
> {
>     CListCtrl& ctlList = GetListCtrl();
>     char separator[] = "|"; // tokens are separated by vertical pipe char

>     char* token = strtok( szValue, separator );

>     while( token != NULL )
>     {
>         ctlList.InsertItem(iRow, sName);
>         ctlList.SetItemText(iRow, 1, token );    // may or may not work?
>          token = strtok( NULL, separator );    // Get next token
>          iRow++;  // advance row
>      }
> }

> I have stepped through the code and verified that the tokens are being
> parsed corectly, but to my surprise, on some calls to InsertToken( ) the
> SetItemText call will either consistently succeed or consistently fail. By
> fail, I mean that no text is changed in the desired cell of the listctrl.

> Anybody have any thoughts?

> Thanks,
> Dean



Sun, 11 Sep 2005 04:30:09 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. CListCtrl difference InsertItem() and SetItemText(0,...)

2. probelm with CListCtrl::SetItemText

3. When CListCtrl::SetItemText will not set the text

4. CListCtrl and SetItemText

5. CListCtrl difference InsertItem() and SetItemText(0,...)

6. Need help with CListCtrl.SetItemText()

7. CListCtrl.SetItemText()

8. When CListCtrl::SetItemText will not set the text

9. List Control LVS_SORTASCENDING and SetItemText

10. using SetItemText to print a CString

11. SetItemText Not Working In CListView::OnUpdate

12. SetItemText doesn't work in CListView::OnUpdate

 

 
Powered by phpBB® Forum Software