VC++
Example: Free ActiveX Grid Control (Written with MFC
Source Code)
|
|
by Michael C. Lombardi
Let me first say to Chris
Maunder and others that originally worked on the grid
GREAT JOB! You guys did a super job developing this control.
Had it not been for the work and effort put forth by the
original team the grid
would have never evolved as far as it did. OK, enough of
the accolades, onto what's new and exciting with this
version of the grid.
First, some of the
smaller improvements
- I gave the grid
a new and improved drop list control.
The previous version of the drop list seemed to work
"clunky". It just didn't seem to flow
"seamlessly" with the grid.
The improved drop list works seamless with the grid,
but more importantly, notice that the background color
of the drop list now matches that of the grid. This
helps the droplets integrate nicely with the grid, and
makes the entire control look more like a single
object.
- The grid
desperately needed check boxes. So I gave it check
boxes for BOOLEAN data that might want to be
displayed. Notice how the check boxes also integrate
seamlessly into the grid,
the grid finally
looks like its one complete control, not a control
that has other controls placed on top of it.
The New Grid!
Obstacles Facing
Previous Versions Of The Grid
For the project I'm working
on, the grid faced two
major obstacles that kept me from using it as it was. The
first obstacle I faced was that I needed a way to save and
restore the grid
contents to and from a Microsoft Access database easily
and speedily. (I'm using Crystal
Reports to generate formatted reports from my database).
This problem I solved using a product I created called the
Database Server. It
works with this version of the grid
and will allow you to easily save the grid
contents, as well as any other Windows common controls,
to and from a Microsoft Access database without having to
write a single line of SQL. How did I do this you ucancode.net?
Visit Software Dynamics Download Area For Software
Engineers and find out how you can too! Plus, checkout
some of the freebies!
The second obstacle that
I faced was that I am working on a project that requires
me to use many different instances of the grid. The
problem with the existing grid
is that everything is programmatic. That's everything from
creating the grid,
setting the number rows, columns, headings, colors, etc.
If your like me and you need to use many grid instances,
this is an extraordinary large amount of programming that
would have to be done using previous versions of the grid.
Not to mention a mound of code that has to be maintained.
I wanted to avoid programmatically creating and
maintaining each grid
that I needed. Simply, I didn't have the time.
Hip-Hip Hooray!!
I solved this obstacle by
creating something that was long overdue, an ActiveX
version of the grid control.
Although the grid can
support many other attributes other than the one's I
exposed via ActiveX
properties, I only exposed properties that I needed. What
does all this buy me you ucancode.net? Well, the answer is that I
have a project with about 150 different dialogs, many of
which need grids, some
of which even use several grids.
I needed a fast and easy way to put each of these grids
on the dialogs without having to do this all
programmatically. So, I simply insert my ActiveX
control (called SDIGrid) into the Microsoft
Visual Studio resource editor, open each dialog the needs
a grid, and drop a grid
onto each dialog the same way I would normally drop a
button, edit box, or any other Windows common control.
This allows me to quickly and easily set the location of
each grid, set the number of columns and rows, set each
fixed row and column heading, and set each columns data
types (whether it be edit list, drop list, or boolean, without
ever even having to write a single line of code! The
sample project included with this control (see picture
above) and the associated control took me about 2 minutes
to create. If the sample program had other dialogs that
also required grids they could be added in a matter of
seconds, and again, I cant stress enough, without ever
having to write a single line of code!
And, as an added benefit
(sounds like a Ginsu knife commercial) , because
ActiveX controls are binary data, you are no
longer limited to using Visual
C++ with the control.
The grid can now be
used in ANY development environment that supports ActiveX
controls.
Summary
Well that's it! I hope you
enjoy using the ActiveX
version of the grid, I
am supplying the source code in addition to a sample
project so anyone can further the Grid's
development. I believe that this new direction for the grid
will allow it to continue to evolve. It has come so far
already, and just keeps getting better.
Downloads
Download
demo project that uses ActiveX
Grid - 20 Kb
Download
source - 156 Kb
|