Solved

How to stop a CListCtrl from blinking

Posted on 1998-10-27
5
1,139 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

696 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