Solved

How to stop a CListCtrl from blinking

Posted on 1998-10-27
5
1,114 Views
Last Modified: 2008-03-06
How can i stop a CListCtrl from excessively blinking when i call the DeleteAllItems() function
thanks in adVance
0
Comment
Question by:mwebster
  • 3
  • 2
5 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1176359
Use the WM_SETREDRAW message to stop redrawing before you delete all the items, and again to enable it afterwards (you may need to force a repaint of the control).

The control mave have BeginUpdate and EndUpdate (or something similar) methods which  encapsulate this.

Cheers,

Raymond.
0
 

Author Comment

by:mwebster
ID: 1176360
can you send me some example code this CListCtrl is on a TabCtrl which is on a DialogBox(so you see my delima)
here's what i do to get a handle to the CListCtrl
      int index = m_Mytab.GetCurSel();
      TC_ITEM item;
      item.mask = TCIF_PARAM;
      m_Mytab.GetItem(index,&item);
      ASSERT(item.lParam);
        CListCtrl* MyCtrl = (CListCtrl*)item.lParam;
        MyCtrl->DeleteAllItems();



0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1176361
Actually use the SetRedraw method (thats the method equivalent I mentioned) od CListCtrl

eg:
MyCtrl->SetRedraw(FALSE);
MyCtrl->DeleteAllItems();
MyCtrl->SetRedraw(TRUE);

Cheers,

Raymond
0
 

Author Comment

by:mwebster
ID: 1176362
Still didn't work i Still get the blicking when i switch from tab to tab cuz as i switch to each tab the data for the specific CListCtrl must be updated
0
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 100 total points
ID: 1176363
Then do the same thing when you populate the list controll with data: (perhaps you should do the clear and populate in the same redrw suppression:)

       MyCtrl->SetRedraw(FALSE);
       MyCtrl->DeleteAllItems();
       // Add all the bits to your control
       MyCtrl->SetRedraw(TRUE);

       Cheers,

       Raymond
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question