Click here to Skip to main content
Licence CPOL
First Posted 12 May 2000
Views 290,189
Bookmarked 153 times

The Grid Control

The grid is a fully featured control for displaying tabular data. There are MFC and ATL versions that run on everything from CE to Windows 2000
1 vote, 7.7%
1

2

3
1 vote, 7.7%
4
11 votes, 84.6%
5
4.79/5 - 76 votes
1 removed
μ 4.62, σa 1.96 [?]

Introduction

After pushing the CListCtrl to its limits in trying to display and edit tabulated data I decided what was really needed was a dedicated grid control. I started writing my own grid control from scratch but decided to save time by modifying Joe Willcoxson's free WorldCom grid control. I tore apert his code and rebuilt it from the ground up in order to get it to do all the things I needed. The code has gone through so many modifications that I'm not sure if there is even a single original line of code. In any case Joe's code was a great framework on which to build.

Since the initial release at the beginning of 1998 there have been many, many versions of the grid - some better than others. There have also been ports to CE, an ATL version, and extensions that include a tree-list control.

The list of all those who have contributed and provided fixes, bug reports and suggestions is too huge to mention - thanks everyone!

The Grid Control articles and projects

The Grid

MFC Grid control - Chris Maunder
A fully featured grid control for displaying tabular data that is derived from CWnd

Plug-in cell types

Tree control and Buttons for MFC Grid control - Ken Bertelson
A set of classes derived from CGridCtrl that embed a tree control, button controls, and virtual cells within the grid

Using comboboxes in the MFC Grid Control - Chris Maunder
Explains how to use comboboxes to edit cells in the MFC Grid Control

Adding Hyperlink support to the MFC Grid Control - Fred Ackers and Chris Maunder
A new class that adds hyperlink support to the MFC Grid Control

Using the Grid

Using the Grid Control in a Doc/View framework - Chris Maunder
A simple tutorial that demonstrates how to use the grid control in a doc/view application.

ActiveX version

ATL Grid control - Mario Zucca
A grid control for displaying tabular data, based on Chris Maunder's grid control

License

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

About the Authors

Chris Maunder

Founder
The Code Project
Canada Canada

Member

Follow on Twitter Follow on Twitter
Chris is the Co-founder, Administrator, Architect, Chief Editor and Shameless Hack who wrote and runs The Code Project. He's been programming since 1988 while pretending to be, in various guises, an astrophysicist, mathematician, physicist, hydrologist, geomorphologist, defence intelligence researcher and then, when all that got a bit rough on the nerves, a web developer. He is a Microsoft Visual C++ MVP both globally and for Canada locally.
 
His programming experience includes C/C++, C#, SQL, MFC, ASP, ASP.NET, and far, far too much FORTRAN. He has worked on PocketPCs, AIX mainframes, Sun workstations, and a CRAY YMP C90 behemoth but finds notebooks take up less desk space.
 
He dodges, he weaves, and he never gets enough sleep. He is kind to small animals.
 
Chris was born and bred in Australia but splits his time between Toronto and Melbourne, depending on the weather. For relaxation he is into road cycling, snowboarding, rock climbing, and storm chasing.

Ken Bertelson



United States United States

Member


Mario Zucca

Web Developer

Italy Italy

Member


Fred Ackers

Web Developer

United States United States

Member
Programming using MFC and ATL for almost 12 years now. Currently studying Operating System implementation as well as Image processing. Previously worked on DSP and the use of FFT for audio application. Programmed using ADO, ODBC, ATL, COM, MFC for shell interfacing, databasing tasks, Internet items, and customization programs.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionBug fix for frozen columns PinmemberDavid Pritchard5:58 13 Sep '11  
AnswerRe: Bug fix for frozen columns PinmemberDavid Pritchard5:59 13 Sep '11  
QuestionIs any full row selection api? PinmemberERLN2:37 10 Aug '11  
GeneralNumbers only PinmemberMember 2608808:44 8 May '11  
QuestionCan't create MFCGridCtrl in the DLL dialog Pinmembers9510301021:54 25 May '10  
QuestionCFormView-based application doesn't catch the WM_NOTIFY messages Pinmemberhjfyyy5:33 9 Apr '10  
Questionany vb.net version? Pinmemberfira211116:41 24 Feb '08  
GeneralFlikerring in Grid Pinmemberkansagous20:21 25 Dec '07  
Questionc++ compiler code PinmemberHrishikesh Raverkar7:28 2 Apr '07  
QuestionScrolling with keyboard after changing window Pinmemberensger4:38 9 Mar '07  
Hallo all,
 
This grid seems be almost perfect. But I have one problem (more of course, but one that is so serious that I have now to decide to use it or not).
 
I'm using the grid in a view, and I always have to click in the grid first, before I con scroll with the keyboard. So I cannot work without mouse. After clicking, it's perfect. But I have an MDI-progam, and it's making me nervous to have to click into the grid every time after changing the window.
 
Thought that I made something wrong but tried it even with the demo-program 'gridctrl_in_view' - the same probelm???
 
Any answer would be helpful and I would be happy if I could decide to use this grid, Gerard



GeneralI need a VB source code about MSFlexGrid PinmemberHoangTuCoDon17:48 12 Oct '05  
Generali need C++ projecty PinsussAnonymous13:09 30 Sep '05  
GeneralRe: i need C++ projecty Pinmembertoxcct1:05 10 Jan '06  
Questioni need project in C++ PinsussAnonymous13:07 30 Sep '05  
Questioni need C++ project PinsussAnonymous13:04 30 Sep '05  
GeneralResizing Columns PinmemberJohn Simmons / outlaw programmer5:18 9 Feb '05  
QuestionBlinking cells - anyone interested? PinmemberJohn Simmons / outlaw programmer4:25 7 Feb '05  
AnswerRe: Blinking cells - anyone interested? PinmemberStober5:36 23 Feb '06  
GeneralRe: Blinking cells - anyone interested? PinmemberJohn Simmons / outlaw programmer11:32 21 Mar '06  
AnswerRe: Blinking cells - anyone interested? PinmemberGarth J Lancaster1:53 5 Feb '07  
GeneralRe: Blinking cells - anyone interested? PinmvpJohn Simmons / outlaw programmer13:52 5 Feb '07  
GeneralRe: Blinking cells - anyone interested? PinmemberGarth J Lancaster14:45 5 Feb '07  
GeneralGetting WM_MOUSEMOVE message in parent window PinmemberJohn Simmons / outlaw programmer1:30 29 Sep '04  
GeneralRe: Getting WM_MOUSEMOVE message in parent window PinmemberJohn Simmons / outlaw programmer12:05 30 Sep '04  
GeneralProblem selecting item from a combo box cell Pinmemberrsegal7:24 2 Jan '04  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web01 | 2.5.120210.1 | Last Updated 6 Jun 2000
Article Copyright 2000 by Chris Maunder, Ken Bertelson, Mario Zucca, Fred Ackers
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid