SetItemText Not Working In CListView::OnUpdate 
Author Message
 SetItemText Not Working In CListView::OnUpdate

Sorry, I may have accidently sent the first one on error. Here is my issue.

Inside of OnInitialUpdate I have this code

 CListView::OnInitialUpdate();

 //add columns to list view
 GetListCtrl().InsertColumn(0, _T("State"), LVCFMT_LEFT, 96);
 GetListCtrl().InsertColumn(1, _T("Capital"), LVCFMT_RIGHT, 96);
 GetListCtrl().InsertColumn(2, _T("Area (sq. miles)"), LVCFMT_RIGHT, 96);

 CListCtrl& lst = GetListCtrl();
 lst.InsertItem(0, _T("Tennessee"));
 lst.SetItemText(0, 1, _T("Nashville"));
 lst.SetItemText(0, 2, _T("41,434"));

This code works as expected but if I take the last block of code above and
cut and paste it into the OnUpdate function what happens is that the two
SetItemText functions have no effect. I'm not quite sure why that is the
case. Could someone inform me on this? Thanks alot.

Ron



Thu, 12 Aug 2004 03:55:17 GMT  
 SetItemText Not Working In CListView::OnUpdate

Quote:

> Sorry, I may have accidently sent the first one on error. Here is my issue.

> Inside of OnInitialUpdate I have this code

>  CListView::OnInitialUpdate();

>  //add columns to list view
>  GetListCtrl().InsertColumn(0, _T("State"), LVCFMT_LEFT, 96);
>  GetListCtrl().InsertColumn(1, _T("Capital"), LVCFMT_RIGHT, 96);
>  GetListCtrl().InsertColumn(2, _T("Area (sq. miles)"), LVCFMT_RIGHT, 96);

>  CListCtrl& lst = GetListCtrl();
>  lst.InsertItem(0, _T("Tennessee"));
>  lst.SetItemText(0, 1, _T("Nashville"));
>  lst.SetItemText(0, 2, _T("41,434"));

> This code works as expected but if I take the last block of code above and
> cut and paste it into the OnUpdate function what happens is that the two
> SetItemText functions have no effect. I'm not quite sure why that is the
> case. Could someone inform me on this? Thanks alot.

> Ron

Single step into OnInitialUpdate and see if it calls your OnUpdate
before you have done the InsertColumn calls.

--
Scott McPhillips [VC++ MVP]



Thu, 12 Aug 2004 04:19:29 GMT  
 SetItemText Not Working In CListView::OnUpdate
Yes, that's his problem.  The base class OnInitialUpdate calls OnUpdate with 0
parameters before returning to the derived class version, where he then does
InsertColumn.


Thu, 12 Aug 2004 21:15:44 GMT  
 
 [ 3 post ] 

 Relevant Pages 

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

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

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

4. OnUpdate - document is not completly displayed

5. OnUpdate for tree and list view not called

6. Help! UpdateAllViews is not calling OnUpdate

7. C++/ATL/ADO - Intellisense not working (statement completion options) not working

8. this code works on SGI does not work on linux

9. CMap Lookup not working (at least I cannot get it to work)

10. Program not work at release mode but work at debug mode

11. GetPrivateProfileSectionNames not working in 98 or ME but does work in 2000

12. CListView: LVS_REPORT doesn't work (fine)

 

 
Powered by phpBB® Forum Software