Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to stop a CListCtrl from blinking

Posted on 1998-10-27
5
Medium Priority
?
1,200 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 400 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

971 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