Click here to Skip to main content
13,557,288 members
Click here to Skip to main content
Add your own
alternative version


11 bookmarked
Posted 13 May 2005
Licenced CPOL

Blinking Cells For Chris Maunder's Grid Control

Rate this:
Please Sign up or sign in to vote.
Create blinking cells for Chris Maunder's grid control.


I had cause to make use of Chris Maunder's outstanding grid control in a recent project, but it was missing some very necessary functionality - the ability to blink one or more cells. This article discusses how I added this capability. It boils down to a derived class that does the work, and a thread that provides the ticker to turn on/off a "blinking cell" (I don't really believe in WM_TIMER). I used the code from these two additional CP articles:


Since the grid control supports cell colors, all I had to do was come up with a way to make a cell look like it was blinking, and then come with a way to actually make it blink. To make it look like it was blinking, I came up with a class that contains the original colors of the specified cell, as well as the blink colors for the specified cell. How you determine these colors is completely up to you, and most likely it's going to be application-specific. For our application, we wanted the cell to blink with a red background and white text.

The CBlinkCell Class

This class is extremely simple having nothing more than variables that contain the cell's row, column, and original background and foreground colors.

The CBlinkCellList Class

This class is equally simplistic in its construction, and it merely contains a list of cells that are supposed to be blinking. If a CBlinkCell item is in this list, the CBlinkGridCtrl class will blink the cell (specified by the row/column data members) until it's removed from the list. This class allows you to add and remove/delete cells from the blink list.

The CBlinkGridCtrl Class

This class is derived from the original CGridCtrl class, and simply adds the new blinking functionality. This way, you can insert this class at the appropriate spot in your inheritance chain without losing any functionality that you added to the grid control (or your own derived classes).

Using the CBlinkGridCtrl Class

Simply derive your own grid control from CBlinkGridCtrl. After that, it's a simple matter of starting the blink thread (which you can do from within your derived grid control), and then writing code to turn blinking for the desired cell(s) on and off.


I put the resource ID for the grid control used in the sample app into the file Constants.h. This is also where the user defined message for the blink tick is found.

Credit Where Credit Is Due

Many thanks go out to Chris Maunder for writing the original CGridCtrl code. We're currently using that code in an application that tracks patients as they are serviced in a trauma center.

The thread class I'm using was originally written by Dominik Filipp. It's an old article (from 1999) here on CP, but it does the job quite nicely. I also make use of his thread class in many of my own applications.

Links to both of these articles are provided at the beginning of the article.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

John Simmons / outlaw programmer
Software Developer (Senior) Paddedwall Software
United States United States
I've been paid as a programmer since 1982 with experience in Pascal, and C++ (both self-taught), and began writing Windows programs in 1991 using Visual C++ and MFC. In the 2nd half of 2007, I started writing C# Windows Forms and ASP.Net applications, and have since done WPF, Silverlight, WCF, web services, and Windows services.

My weakest point is that my moments of clarity are too brief to hold a meaningful conversation that requires more than 30 seconds to complete. Thankfully, grunts of agreement are all that is required to conduct most discussions without committing to any particular belief system.

You may also be interested in...


Comments and Discussions

GeneralSlider in a Cell Pin
Tier525-Feb-06 10:42
memberTier525-Feb-06 10:42 
GeneralRe: Slider in a Cell Pin
John Simmons / outlaw programmer26-Feb-06 1:16
memberJohn Simmons / outlaw programmer26-Feb-06 1:16 
Generalbroken link Pin
r.guerzoni16-May-05 1:55
memberr.guerzoni16-May-05 1:55 
GeneralRe: broken link Pin
John Simmons / outlaw programmer16-May-05 5:37
memberJohn Simmons / outlaw programmer16-May-05 5:37 
Generaldislike of WM_TIMER Pin
.dan.g.15-May-05 14:02
member.dan.g.15-May-05 14:02 
GeneralRe: dislike of WM_TIMER Pin
John Simmons / outlaw programmer16-May-05 5:06
memberJohn Simmons / outlaw programmer16-May-05 5:06 
General"Legal Disclaimer" offensive Pin
csmac314413-May-05 10:17
membercsmac314413-May-05 10:17 
Generaland by posting this you hope to....? Pin
MadHatter ¢13-May-05 12:33
MadHatter ¢
13-May-05 12:33 
GeneralIrrelevant Pin
DaTxomin15-May-05 5:29
memberDaTxomin15-May-05 5:29 
GeneralRe: Irrelevant Pin
John Simmons / outlaw programmer16-May-05 5:29
memberJohn Simmons / outlaw programmer16-May-05 5:29 
GeneralRe: Irrelevant Pin
DaTxomin16-May-05 6:44
memberDaTxomin16-May-05 6:44 
GeneralRe: "Legal Disclaimer" offensive Pin
Bill S15-May-05 2:07
memberBill S15-May-05 2:07 
GeneralRe: "Legal Disclaimer" offensive Pin
.dan.g.15-May-05 14:01
member.dan.g.15-May-05 14:01 
GeneralRe: "Legal Disclaimer" offensive Pin
John Simmons / outlaw programmer16-May-05 5:30
memberJohn Simmons / outlaw programmer16-May-05 5:30 
GeneralRe: "Legal Disclaimer" offensive Pin
Shog915-May-05 17:16
memberShog915-May-05 17:16 
GeneralRe: "Legal Disclaimer" offensive Pin
John Simmons / outlaw programmer16-May-05 5:32
memberJohn Simmons / outlaw programmer16-May-05 5:32 
GeneralRe: "Legal Disclaimer" offensive Pin
John Simmons / outlaw programmer16-May-05 5:06
memberJohn Simmons / outlaw programmer16-May-05 5:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180515.1 | Last Updated 13 May 2005
Article Copyright 2005 by John Simmons / outlaw programmer
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid