Solved

How to stop a CListCtrl from blinking

Posted on 1998-10-27
5
1,098 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

760 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now