| Chapter 4: VCL Builder Walk-Through |
|
The
following information demonstrates how to create your first Builder /
ProEssentials implementation. It discusses installation, adding ProEssentials
to a project, writing your first few lines of code, and shows the final
results.
When
installing the ProEssentials evaluation and/or product, the setup program
installs the ProEssentials DLL into the system directory. It also installs
the ProEssentials VCL interfaces into C:\ProEssentials6\Builder. Your
relevant files are:
|
| gigasoft.bpk... |
Files... |
|
|
|
PEGRP32D.DLL
|
ProEssentials Pro DLL |
| PEGRP32D.LIB |
Import Library |
| GIGASOFT.BPK |
Builder Package
|
| PEGRPAPI.PAS |
ProEssentials
Constants and Declarations |
| PEGVCL.PAS |
Graph |
| PESGVCL.PAS |
Scientific
Graph |
| PE3DVCL.PAS |
3D Scientific
Graph |
| PEPSVCL.PAS |
Polar |
| PEPCVCL.PAS |
Pie |
| PEGCPP.CPP |
Graph CPP
helper |
| PESGCPP.CPP |
Scientific
Graph CPP helper |
| PE3DCPP.CPP |
3D Scientific
Graph CPP helper |
| PEPSCPP.CPP |
Polar CPP
Helper |
| PEPCCPP.CPP |
Pie CPP
Helper |
|
PEGRPDS.DLL
|
ProEssentials Standard DLL |
| PEGRPDS.LIB |
Import
Library |
|
PEGRPDL.DLL
|
ProEssentials Lite DLL |
| PEGRPDL.LIB |
Import
Library |
|
|
After installation, launch
Builder and use the File / Close All, and then File / Open menu to open
the file "GIGASOFT.BPK" found in
the C:\ProEssentials6\Builder directory. You
see a window as shown to the left. Click the "Install" button
and the PAS/CPP interfaces are compiled and ProEssentials components installed
into the "Additional" tab. Note that currently you're required
to change <PEGRPAPI.HPP> to "PEGRPAPI.HPP" for the project to compile.
Installing into Builder 6 requires an extra step related to TRect and
TPoint. You must remove the code "Windows::"
which resides in front of TRect and TPoint, for example, Windows::TRect rectHotSpot needs changing to TRect rectHotSpot. The install process will point
you to all the relative locations that need adjusting. We apologize for
this inconvenience but Borland generates the HPP files. At any rate, this
is a minor issue as it only takes a minute to install, and once installed,
you won't have further problems. Find the ProEssentials components within
the "Additional" tab.
|
| Project / Options... Dialog |
Builder project... |
|
After the components are
installed, use the File / Close All menu item and save the modified HPP
files and "Gigasoft" package as prompted.
Next, use the File / New
Application menu item to create a new EXE project.
Next, use the Project
/ Options... menu to open the "Project Options" dialog as shown
to the left. Add "C:\ProEssentials6\Builder"
to the "Include path" and "Library path" fields and select "OK".
Next, use the Project
/ Add to Project... menu to add the file "PEGRP32D.LIB"
found in the "C:\ProEssentials6\Builder" directory. If using
Standard or Lite versions, use respective LIB file.
|
| Form1... |
Adding
ProEssentials to a Form... |
|
|
Click the control from the Additional ToolBox and then click and
drag a rectangle selection on Form1's canvas.
The adjacent image shows what you see. This
represents the default state of a ProEssentials Graph. The default state
has one subset with four data points. In the course of constructing your
own charts, you'll set the properties Subsets
and Points which define the quantity of
data your chart will hold. You'll then pass data via the YData[subset][point]
two dimensional property array. The following section shows example code
of passing data. Note, if we were constructing a Scientific Graph (PESGraph1),
we'd also set XData[subset][point].
ProEssentials uses the
terms Subsets and Points but you can think of these as Rows and Columns.
Passing data is as simple as filling each Subset with Points worth of
data. |
| Unit1.cpp... |
Code Comments... |
|
Use Builder's
Object Inspector to add the FormShow event handler to the project. Enter the code as shown to
the left.
The first two lines set Subsets
and Points. These define the amount of data
you'll be passing.
Next, a nested for loop passes random data
into the YData[s][p] two dimensional property
array.
Next, MainTitle
and SubTitle are set. Note that setting
SubTitle to an empty string hides the subtitle. The YAxisLabel
and XAxisLabel are set similarly.
SubsetLabels[0]
sets the first subset label. [1] sets the second subset label.
Next, we set various
other properties controlling visual aspects.
Finally, PEactions
is set to gReinitAndReset which tells ProEssentials you're done setting
properties. |
| Results... |
Congratulations... |
|
Use Builder's Run / Run
Menu (short cut F9) and you'll see the resulting form to the left. Congratulations,
you've just completed your first Builder / ProEssentials implementation.
This example is very
simple and you'll likely set other properties such as:
PointLabels
which will replace the "1,2,3..." along x axis.
SubsetLineTypes
which controls line styles.
SubsetColors
which controls line colors.
PlottingMethod
which controls the type of chart created, Line, Bar, Area, Point, etc.
|
|