CListCtrl.SetItemText() 
Author Message
 CListCtrl.SetItemText()

Quote:

> Hi,

> I am using a CListCtrl directly within a dialog box.  I use its member
> function InsertColumn( ) to create columns, and InsertItem() to create
> new items.  After these are done, I tried to use SetItemText() to set
> the text for the sub items.  For some reason, only some of the text
> would show up within the control and some don't.  Has anyone experience
> this problem?  Does anyone knows what I have done wrong?

> Any suggestion is appreciated, Thanks in advance!!!

I have experienced this as well - I'll bet you have sorting turned on?
I don't know why this happens but I think you have to write your own
sort routine.  Let me know what you find.


Sat, 28 Aug 1999 03:00:00 GMT  
 CListCtrl.SetItemText()

Hi,

I am using a CListCtrl directly within a dialog box.  I use its member
function InsertColumn( ) to create columns, and InsertItem() to create
new items.  After these are done, I tried to use SetItemText() to set
the text for the sub items.  For some reason, only some of the text
would show up within the control and some don't.  Has anyone experience
this problem?  Does anyone knows what I have done wrong?

Any suggestion is appreciated, Thanks in advance!!!



Sat, 28 Aug 1999 03:00:00 GMT  
 CListCtrl.SetItemText()

Try this...

for (nItem=0; nItem<numberOfRows; nItem++)
{
        // Insert a the item first with a blank
        m_yourListCntl.InsertItem(nItem, " ");

        // Populate the screen with the new data
        m_yourListCntl.SetItemText(nItem, 1, "SubItem1_Text");
        m_yourListCntl.SetItemText(nItem, 2, "SubItem2_Text");

Quote:
}



| Hi,
|
| I am using a CListCtrl directly within a dialog box.  I use its member
| function InsertColumn( ) to create columns, and InsertItem() to create
| new items.  After these are done, I tried to use SetItemText() to set
| the text for the sub items.  For some reason, only some of the text
| would show up within the control and some don't.  Has anyone experience
| this problem?  Does anyone knows what I have done wrong?
|
| Any suggestion is appreciated, Thanks in advance!!!
|


Sat, 28 Aug 1999 03:00:00 GMT  
 CListCtrl.SetItemText()

The previous response only works if sorting is turned off.  If it is turned
on, do the following instead:

int i,nItem;

 for (i=0; i<numberOfRows; i++)
 {
        // I'm recalling this from memory,  so you may want to check on-line help,
but I believe
        // that the first parameter should be -1 in order for an item to be
inserted wherever.
        // InsertItem will then return the item number that you need to use for
the sub items.
        nItem = m_yourListCntl.InsertItem(-1,"First Column Data");

        // Populate the screen with the new data
        m_yourListCntl.SetItemText(nItem, 1, "SubItem1_Text");
        m_yourListCntl.SetItemText(nItem, 2, "SubItem2_Text");
 }

Regards,
Mike Kares



Sat, 28 Aug 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. CListCtrl::SetItemText( ) problem

2. probelm with CListCtrl::SetItemText

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

4. Need help with CListCtrl.SetItemText()

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

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

7. CListCtrl and SetItemText

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

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