If you had a first sight on the component's documentation and you will like using it,
you can follow the next steps to see how to add the component to a form, adding
code, and handing events. This tutorial will guide
how to start programming/coding the eXG2antt component. These steps are similar for other components as
well.

info If the /NET is
listed in the programming language name it means that the section is applied to
/NET version of the component, if the /WPF is
listed in the programming language name it means that the section is applied to
WPF version of the component, else the COM or ActiveX version is being
used. For instance, the VB.NET ( /WPF )
specifies that the /WPF component is using on VB.NET programming language. The VB.NET (
/COM ) and C# ( /COM
) indicates that the /COM or ActiveX version is using on VB.NET/C# programming
language

The tutorial shows adding and using the component for the following
programming languages:

The first thing we need is to be able to insert the component to a form,
dialog or window.

Access. Click the More Controls icon in the Toolbox, locate and
select the ExG2antt Chart
ActiveX Control in the shortcut menu being opened. Click the form and drag
the cursor to a new position, so the control is being inserted to your form.

VB6. Select the Project\Components (CTRL+T) and locate the ExG2antt
Control Library, check it, and click the OK button. The G2antt icon shows in
the Toolbox, double click it or select and put it to your form.

VFP. Select Tools\Options\Controls and locate the ExG2antt Chart
ActiveX Control in Selected list box. Check it, and click the Set As
Default, then click OK. The ExG2antt icon is shown in the Form Controls
toolbox, click it, so the cursor is changed, go to the for and put it (
click and drag the cursor to a new position ).

VB.NET ( /NET ). Right click the Toolbox, select the Choose
Items, and then select the .NET Framework Components page, click the
Browse button, so the Open file dialog is shown. Locate the
exontrol.exg2antt.dll ( usually it goes to the C:\Program Files\Exontrol\ExG2antt.NET
folder ), select it, and click OK, so the .NET Framework Components list
displays a new checked items called exg2antt. Click ok. The toolbox includes
the exg2antt icon, double click it.

VB.NET ( /WPF ). Right click the Toolbox, select the Choose
Items, and then select the WPF Components page, click the
Browse button, so the Open file dialog is shown. Locate the wpf.exontrol.exg2antt.dll ( usually it goes to the C:\Program
Files\Exontrol\ExG2antt.WPF
folder ), select it, and click OK, so the WPF Components list
displays a new checked items called exg2antt. Click ok. The toolbox includes
the exg2antt icon, double click it.

C# ( /NET ). Right click the Toolbox, select the Choose
Items, and then select the .NET Framework Components page, click the
Browse button, so the Open file dialog is shown. Locate the
exontrol.exg2antt.dll ( usually it goes to the C:\Program Files\Exontrol\ExG2antt.NET
folder ), select it, and click OK, so the .NET Framework Components list
displays a new checked items called exg2antt. Click ok. The toolbox includes
the exg2antt icon, double click it.

C# ( /WPF ). Right click the Toolbox, select the Choose
Items, and then select the WPF Components page, click the
Browse button, so the Open file dialog is shown. Locate the wpf.exontrol.exg2antt.dll ( usually it goes to the C:\Program
Files\Exontrol\ExG2antt.WPF
folder ), select it, and click OK, so the COM Components list
displays a new checked items called exg2antt. Click ok. The toolbox includes
the exg2antt icon, double click it.

C++ (6.0). Select the dialog where you need to insert the control. Right
click, and select the Insert ActiveX control, locate and select the
ExG2antt Chart ActiveX Control and then click ok. Select the Properties of
the Dialog, and click the Styles page, and check the Clip siblings and Clip
children styles. This will prevent flickering when the form is resized.
Invoke the MFC ClassWizard ( CTRL + W, or select the control and then right
click, and the select ClassWizard item in the shortcut menu ), click the
Member Variables page, select the IDC_G2ANTT1 identifier in the Control IDs
list, and click the Add Variable ... button, so a member variable is added.
Confirm the classes going to be added to your project and select OK. Specify
the name of the member variable being inserted as m_g2antt for instance.
Click OK, and the Close the MFC ClassWizard, by clicking again the OK
button.

C++ (2005,2008). Select the dialog in design mode, where you need to insert the
control, in the Resource \ Dialog section. Right
click, and select the Insert ActiveX control, locate and select the
ExG2antt Chart ActiveX Control and then click ok. The control is
automatically added to your dialog. In the same time, you can change the
Clip Children and Clip Siblings properties of the dialog, so the control
inside will not flicker when resizing the form or the dialog. Select the
control in design mode, and then right click, and select the Add Variable
shortcut menu, specify the name of the variable to be created ( Variable
name field ), m_g2antt1 for instance, and then click Finish button.

C++ Builder (2009). Select the "Component \Import
Component..." and then "Import ActiveX Control" or "Import .NET
Assembly", depending on what version you are about to import. If ActiveX, select the
ExG2antt Control Library from the list of "Registered ActiveX Controls", and
then click Next. You will be informed of the "Generated import file", Check the
"Generate Component Wrappers", Click Next, and select "Install To New
Package" , Click Next, and type the name of the new package as being exg2antt, Click
Finish. The exgantt.bpl package is generated and installed. Select the Form where you want
to insert the component, and then locate the TG2antt in the ActiveX section of the IDE's
Tool Palette. Double click it or drag it to your form, so the component will be inserted
to the form. Activate the Project that contains the form, so you can run it, else the
Package will be activated, for which you will be asked for parameters to run. Note
that in case you are importing the /NET Assembly of the control, you must click Add in the
"Import Component" dialog, and locate the file exontrol.exg2antt.dll ( usually
it goes to the C:\Program Files\Exontrol\ExG2antt.NET folder ).

X++ (Dynamics Ax 2009) Click the Application Object Tree (AOT), so
the AOT window is opened. Open the Forms folder, and then create a new form,
or select an existing one. Expands the form being selected, so you can see
the Designs item, and locate the Design node. Right-click the Design node for the form, and then select New Control.
Select ActiveX from the submenu. Choose the control that you want to insert,
in our case, ExG2antt
Chart ActiveX Control. Click the Properties of the newly ActiveX member
inserted, and go to the Name and type exg2antt1, so you assign a name for
your component.

Delphi (2009). Select the "Component \Import Component..."
and then "Import ActiveX Control" or "Import .NET Assembly", depending
on what version you are about to import. If ActiveX, select the ExG2antt Control Library
from the list of "Registered ActiveX Controls", and then click Next. You will be
informed of the "Generated import file", Check the "Generate Component
Wrappers", Click Next, and select "Install To New Package" , Click Next,
and type the name of the new package as being exg2antt, Click Finish. The exgantt.bpl
package is generated and installed. Select the Form where you want to insert the
component, and then locate the TG2antt in the ActiveX section of the IDE's Tool Palette.
Double click it or drag it to your form, so the component will be inserted to the form.
Activate the Project that contains the form, so you can run it, else the Package will be
activated, for which you will be asked for parameters to run. Note that in case you
are importing the /NET Assembly of the control, you must click Add in the "Import
Component" dialog, and locate the file exontrol.exg2antt.dll ( usually it goes to the
C:\Program Files\Exontrol\ExG2antt.NET folder ).

Clarion. Put OCX control on Window, name it like ?Gantt.
At window.Init, put this code: ?Gantt{PROP:Create} = 'Exontrol.G2antt.1\!XXXXXXXX'
where XXXXXXXX is runtime license, OR - Put OCX control on Window, name
it like ?Gantt. Under Object type: enter Exontrol.G2antt.1, under Storage
type: enter something like this: Gantt.prp\!GanttProperty. Then you can
use Propertis of Gantt contril, but must distribute Gantt.prp

PowerBuilder (Classic). Add or open
the Window where the control should be hosted/displayed. Open the
"Layout" tab of the Window. Click the Insert\Control\OLE... from
the main menu. A new dialog, Insert Object is displayed, and select the
Insert Control page, where you have to look for the ExG2antt
Chart ActiveX Control in the Control Type list. Double Click the ExG2antt
Chart ActiveX Control. The Insert Object dialog is closed, and the Plus
arrow is shown. Click the Window ( in the Layout page ) so you can specify
the portion of the window to display the newly inserted control. The name of
the new control being inserted is ole_1 of the OLECustomControl type. If the
application has no script for open event, add the script to open the Window,
as open(twindow), where twindow is the name of the Window to host the
control.

dBASE Plus. Open the form in
design mode, where you need to insert the component. Open the
"Component Palette" tool, and go to ActiveX page. Right click on
page, and select "Set Up ActiveX Components..." from the context
menu. A "Set Up ActiveX Components" dialog is opened, and in the
Available components list looks for "ExG2antt Chart
ActiveX Control" and select or double click it, so the ExG2antt Chart
ActiveX Control will be shown in the Selected Components list. Click OK, and
so the ActiveX page of the "Component Palette" tool, must include
the newly inserted component, in this case the ExG2antt control. Now, select
the form in design mode, and click the icon of the newly inserted control in
the ActiveX page, and go to the form to include the newly object. Resize the
newly activex. The name of the newly inserted object is activex1. In the
following snippets of code, the activex1 will indicates the name of the
ExG2antt control hosted to your form.

Visual DataFlex. Click on the Create New button on the Studio’s toolbar. Click on the Class tab. Double-click the Import COM ActiveX icon. After the list of available ActiveX controls on your PC populates, select
"ExG2antt 1.0 Control Library (version 1.0)". version of the control may vary slightly with your operating system. You should see a message box that informs you that the control has imported successfully. After clicking Ok on the message box dialog, the newly created Visual DataFlex package for the control should load in the Studio. The cComG2antt.pkg package may be created. Now, open the form where the control should be inserted. Drop a cComG2antt control onto the view from the ActiveX group of the Class Palette. (View\Class Palette).

Xbase++. Open the Xbase++ Form
Designer, click the ActiveX Controls palette, and then click the ? button in
the selected toolbar, so the Insert ActiveX Control... dialog is shown. Look
and select the "ExG2antt Chart ActiveX Control" in the list. If is
is not listed, it means that you actually, have not installed the control
you are trying to insert to a form. Go to the Property Monitor, and change
the ClipSiblings and ClipChildren properties to TRUE .T. Save and run the
form.

Resizes the component in the form, save the project and run the form to see
it running. At this time, the control is not initialized, so it should look like
follows:

Now, let's add some code in order to have some items inside. The
sample adds a single column and two items. Go Back.

Access. In design mode, select the component, open the properties
and changes the name from ActiveXCtl1 to G2antt1. Select again the
component, right click, and select the "Build Events".
Select the Form in the left drop down, so the Form_Load event is added. Copy
and paste the following code:

Private Sub Form_Load()
Dim g As EXG2ANTTLib.G2antt
Set g = G2antt1.Object
With g
.Columns.Add ("Tasks")
With .Items
.AddItem "Task 1"
.AddItem "Task 2"
End With
End With
End Sub

VB6. In design mode, double click the form, so the Form_Load event is added and add
the following code:

Private Sub Form_Load()
With G2antt1
.Columns.Add ("Tasks")
With .Items
.AddItem "Task 1"
.AddItem "Task 2"
End With
End With
End Sub

VFP. In design mode, double click the form, and select the Init in the Procedure
drop down, so the Form1_Init is added as follow:

VB.NET ( /COM ). In design mode, double click the form so the Form1_Load event is added,
and copy the following code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With AxG2antt1
.Columns.Add("Tasks")
With .Items
.AddItem("Task 1")
.AddItem("Task 2")
End With
End With
End Sub

VB.NET ( /NET ). In design
mode, double click the form so the Form1_Load
event is added, and copy the following code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With Exg2antt1
.Columns.Add("Tasks")
With .Items
.AddItem("Task 1")
.AddItem("Task 2")
End With
End With
End Sub

VB.NET ( /WPF ). In design
mode, select the window and double click it so the Window1_Loaded
event is added, and copy the following code:

Private Sub Window1_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
With Exg2antt1
.Columns.Add("Tasks")
With .Items
.AddItem("Task 1")
.AddItem("Task 2")
End With
End With
End Sub

C# ( /COM ). In design mode, double click the form so the Form1_Load
event is added, and copy the following code:

C++ (2005,2008). The #import <exg2antt.dll> must be called somewhere
in your code, so the EXG2ANTTLib namespace is defined. By default, the class
wizard add a class definition for the main object only, not for all objects
that the component may expose. Using the #import you can import the entire
type library. Now, search for the OnInitDialog method and add the following
code:

X++ (Dynamics Ax 2009). In the AOT window, select the Form that
hosts the control, expand the node, so you can see the Methods node. Right
Click the Methods node, and select the Override Method from submenu, and
init from the next submenu. Now, add the code:

Visual DataFlex. Switch to editor and locate the Procedure OnCreate in Object oComG2antt1 is a cComG2antt. Insert the following code:

Procedure OnCreate
Forward Send OnCreate
Variant vColumns
Get ComColumns to vColumns
Handle hoColumns
Get Create (RefClass(cComColumns)) to hoColumns
Set pvComObject of hoColumns to vColumns
Get ComAdd of hoColumns "Tasks" to Nothing
Send Destroy to hoColumns
Variant vItems
Get ComItems to vItems
Handle hoItems
Get Create (RefClass(cComItems)) to hoItems
Set pvComObject of hoItems to vItems
Get ComAddItem of hoItems "Task 1" to Nothing
Get ComAddItem of hoItems "Task 2" to Nothing
Send Destroy to hoItems
End_Procedure

Xbase++. Open the Visual Xbase++ IDE, create a Win32 application
and replace the Main procedure with the following code:

Once these have been added, you can save and run the project again and
you should get the following result

and previous

Now, once we have columns, and items being added, let's start
working on the chart area so we can get displayed some bars. So, we need to go
back to the form initialization so we can call properties and methods of the
chart object. The red code just changes the first visible date in the chart, and
layout the control's chart on 2 levels first displaying the month, and the
second level displaying the days.

Access. Open the form in design mode, go to "Build Event"
and add the red section to the Form_Load event:

Because dBASE does not support setting or assigning a value to properties
with multiple parameters, our controls provide the TemplateDef and Template
methods, which can be used to compile and run the x-script
code.

Visual DataFlex. Go back to OnCreate procedure of Object oComG2antt and add the red section::

Procedure OnCreate
Forward Send OnCreate
Variant vChart
Get ComChart to vChart
Handle hoChart
Get Create (RefClass(cComChart)) to hoChart
Set pvComObject of hoChart to vChart
Set ComFirstVisibleDate of hoChart to "1/1/2008"
Set ComLevelCount of hoChart to 2
Variant vLevel0
Get ComLevel of hoChart 0 to vLevel0
Handle hoLevel0
Get Create (RefClass(cComLevel)) to hoLevel0
Set pvComObject of hoLevel0 to vLevel0
Set ComLabel of hoLevel0 to "<b><%mmmm%></b> <%yyyy%>"
Set ComUnit of hoLevel0 to OLEexMonth
Send Destroy to hoLevel0
Variant vLevel1
Get ComLevel of hoChart 1 to vLevel1
Handle hoLevel1
Get Create (RefClass(cComLevel)) to hoLevel1
Set pvComObject of hoLevel1 to vLevel1
Set ComLabel of hoLevel1 to "<%d%>"
Send Destroy to hoLevel1
Send Destroy to hoChart
Variant vColumns
Get ComColumns to vColumns
Handle hoColumns
Get Create (RefClass(cComColumns)) to hoColumns
Set pvComObject of hoColumns to vColumns
Get ComAdd of hoColumns "Tasks" to Nothing
Send Destroy to hoColumns
Variant vItems
Get ComItems to vItems
Handle hoItems
Get Create (RefClass(cComItems)) to hoItems
Set pvComObject of hoItems to vItems
Get ComAddItem of hoItems "Task 1" to Nothing
Get ComAddItem of hoItems "Task 2" to Nothing
Send Destroy to hoItems
End_Procedure
End_Object

Visual DataFlex. Go back to OnCreate procedure of Object oComG2antt and replace the green section:

Procedure OnCreate
Forward Send OnCreate
Variant vChart
Get ComChart to vChart
Handle hoChart
Get Create (RefClass(cComChart)) to hoChart
Set pvComObject of hoChart to vChart
Set ComFirstVisibleDate of hoChart to "1/1/2008"
Set ComLevelCount of hoChart to 2
Variant vLevel0
Get ComLevel of hoChart 0 to vLevel0
Handle hoLevel0
Get Create (RefClass(cComLevel)) to hoLevel0
Set pvComObject of hoLevel0 to vLevel0
Set ComLabel of hoLevel0 to "<b><%mmmm%></b> <%yyyy%>"
Set ComUnit of hoLevel0 to OLEexMonth
Send Destroy to hoLevel0
Variant vLevel1
Get ComLevel of hoChart 1 to vLevel1
Handle hoLevel1
Get Create (RefClass(cComLevel)) to hoLevel1
Set pvComObject of hoLevel1 to vLevel1
Set ComLabel of hoLevel1 to "<%d%>"
Send Destroy to hoLevel1
Send Destroy to hoChart
Variant vColumns
Get ComColumns to vColumns
Handle hoColumns
Get Create (RefClass(cComColumns)) to hoColumns
Set pvComObject of hoColumns to vColumns
Get ComAdd of hoColumns "Tasks" to Nothing
Send Destroy to hoColumns
Variant vItems
Get ComItems to vItems
Handle hoItems
Get Create (RefClass(cComItems)) to hoItems
Set pvComObject of hoItems to vItems
HITEM h1
Get ComAddItem of hoItems "Task 1" to h1
Send ComAddBar of hoItems h1 "Task" "1/2/2008" "1/5/2008" Nothing Nothing
HITEM h2
Get ComAddItem of hoItems "Task 2" to h2
Send ComAddBar of hoItems h2 "Task" "1/4/2008" "1/8/2008" Nothing Nothing
Send ComAddLink of hoItems "LKey" h1 "" h2 ""
Send Destroy to hoItems
End_Procedure

Visual DataFlex. : Go back to OnCreate procedure of Object oComG2antt and replace the maroon section:

Procedure OnCreate
Forward Send OnCreate
Variant vChart
Get ComChart to vChart
Handle hoChart
Get Create (RefClass(cComChart)) to hoChart
Set pvComObject of hoChart to vChart
Set ComFirstVisibleDate of hoChart to "1/1/2008"
Set ComLevelCount of hoChart to 2
Variant vLevel0
Get ComLevel of hoChart 0 to vLevel0
Handle hoLevel0
Get Create (RefClass(cComLevel)) to hoLevel0
Set pvComObject of hoLevel0 to vLevel0
Set ComLabel of hoLevel0 to "<b><%mmmm%></b> <%yyyy%>"
Set ComUnit of hoLevel0 to OLEexMonth
Send Destroy to hoLevel0
Variant vLevel1
Get ComLevel of hoChart 1 to vLevel1
Handle hoLevel1
Get Create (RefClass(cComLevel)) to hoLevel1
Set pvComObject of hoLevel1 to vLevel1
Set ComLabel of hoLevel1 to "<%d%>"
Send Destroy to hoLevel1
Set ComOverviewVisible of hoChart to True
Set ComHistogramVisible of hoChart to True
Set ComHistogramView of hoChart to OLEexHistogramCheckedItems
Set ComHistogramHeight of hoChart to 32
Variant vBars
Get ComBars of hoChart to vBars
Handle hoBars
Get Create (RefClass(cComBars)) to hoBars
Set pvComObject of hoBars to vBars
Variant vBar
Get ComItem of hoBars "Task" to vBar
Handle hoBar
Get Create (RefClass(cComBar)) to hoBar
Set pvComObject of hoBar to vBar
Set ComHistogramPattern of hoBar to OLEexPatternDot
Send Destroy to hoBar
Send Destroy to hoBars
Send Destroy to hoChart
Variant vColumns
Get ComColumns to vColumns
Handle hoColumns
Get Create (RefClass(cComColumns)) to hoColumns
Set pvComObject of hoColumns to vColumns
Variant vColumn
Get ComAdd of hoColumns "Tasks" to vColumn Handle hoColumn
Get Create (RefClass(cComColumn)) to hoColumn
Set pvComObject of hoColumn to vColumn
Set ComDef of hoColumn OLEexCellHasCheckBox to True
Send Destroy to hoColumn
Send Destroy to hoColumns
Variant vItems
Get ComItems to vItems
Handle hoItems
Get Create (RefClass(cComItems)) to hoItems
Set pvComObject of hoItems to vItems
HITEM h1
Get ComAddItem of hoItems "Task 1" to h1
Send ComAddBar of hoItems h1 "Task" "1/2/2008" "1/5/2008" Nothing Nothing
HITEM h2
Get ComAddItem of hoItems "Task 2" to h2
Send ComAddBar of hoItems h2 "Task" "1/4/2008" "1/8/2008" Nothing Nothing
Send ComAddLink of hoItems "LKey" h1 "" h2 ""
Send Destroy to hoItems
End_Procedure

Visual DataFlex. Go back to OnCreate procedure of Object oComG2antt and add the maroon section:

Procedure OnCreate
Forward Send OnCreate
Send ComBeginUpdate
Variant vChart
Get ComChart to vChart
Handle hoChart
Get Create (RefClass(cComChart)) to hoChart
Set pvComObject of hoChart to vChart
Set ComFirstVisibleDate of hoChart to "1/1/2008"
Set ComLevelCount of hoChart to 2
Variant vLevel0
Get ComLevel of hoChart 0 to vLevel0
Handle hoLevel0
Get Create (RefClass(cComLevel)) to hoLevel0
Set pvComObject of hoLevel0 to vLevel0
Set ComLabel of hoLevel0 to "<b><%mmmm%></b> <%yyyy%>"
Set ComUnit of hoLevel0 to OLEexMonth
Send Destroy to hoLevel0
Variant vLevel1
Get ComLevel of hoChart 1 to vLevel1
Handle hoLevel1
Get Create (RefClass(cComLevel)) to hoLevel1
Set pvComObject of hoLevel1 to vLevel1
Set ComLabel of hoLevel1 to "<%d%>"
Send Destroy to hoLevel1
Set ComOverviewVisible of hoChart to True
Set ComHistogramVisible of hoChart to True
Set ComHistogramView of hoChart to OLEexHistogramCheckedItems
Set ComHistogramHeight of hoChart to 32
Variant vBars
Get ComBars of hoChart to vBars
Handle hoBars
Get Create (RefClass(cComBars)) to hoBars
Set pvComObject of hoBars to vBars
Variant vBar
Get ComItem of hoBars "Task" to vBar
Handle hoBar
Get Create (RefClass(cComBar)) to hoBar
Set pvComObject of hoBar to vBar
Set ComHistogramPattern of hoBar to OLEexPatternDot
Send Destroy to hoBar
Send Destroy to hoBars
Send Destroy to hoChart
Variant vColumns
Get ComColumns to vColumns
Handle hoColumns
Get Create (RefClass(cComColumns)) to hoColumns
Set pvComObject of hoColumns to vColumns
Variant vColumn
Get ComAdd of hoColumns "Tasks" to vColumn
Handle hoColumn
Get Create (RefClass(cComColumn)) to hoColumn
Set pvComObject of hoColumn to vColumn
Set ComDef of hoColumn OLEexCellHasCheckBox to True
Send Destroy to hoColumn
Send Destroy to hoColumns
Variant vItems
Get ComItems to vItems
Handle hoItems
Get Create (RefClass(cComItems)) to hoItems
Set pvComObject of hoItems to vItems
HITEM h1
Get ComAddItem of hoItems "Task 1" to h1
Send ComAddBar of hoItems h1 "Task" "1/2/2008" "1/5/2008" Nothing Nothing
HITEM h2
Get ComAddItem of hoItems "Task 2" to h2
Send ComAddBar of hoItems h2 "Task" "1/4/2008" "1/8/2008" Nothing Nothing
Send ComAddLink of hoItems "LKey" h1 "" h2 ""
Send Destroy to hoItems
Send ComEndUpdate
End_Procedure

The following snippets of code reference the component using its type library. Go Back.

Access. The name of the library is EXG2ANTTLib while the name of
the main component is G2antt. The native object may be accessed through the
Object property so G2antt1.Object is of EXG2ANTTLib.G2antt
type. While in CodeView mode, you can press the F2 key to open the
"Object Browser" where all libraries are listed.

VB6. The name of the library is EXG2ANTTLibCtl while the name of
the main component is G2antt. The native object may be accessed throw the
object itself or through the Object property so G2antt1 is of EXG2ANTTLibCtl.G2antt
type. While in CodeView mode, you can press the F2 key to open the
"Object Browser" where all libraries are listed.

VFP. The name of the library is EXG2ANTTLib while the name of the
main component is G2antt. The native object may be accessed through the
Object property so G2antt1.Object is of EXG2ANTTLib.G2antt
type. Select Tools, Class Browser, Click Open, select the *.dll, and locate
the exg2antt.dll file. The Class browser will display the component's
library.

VB.NET ( /COM ). The name of the library is EXG2ANTTLib
while the name of the main component is G2antt. The native object may be
accessed through the GetOcx() method so G2antt1.GetOcx() is of EXG2ANTTLib.G2antt
type. Select the View\Class View and locate the Interop.EXG2ANTTLib assembly
where you can find the component's library.

VB.NET ( /NET ). The name of
the library is exontrol.EXG2ANTTLib while the name of the main component is exg2antt.
The native object may be accessed through the object itself so it is
of exontrol.EXG2ANTTLib.exg2antt type. Select the View\Class
View and locate the exontrol.exg2antt assembly where you can find the
component's library.

VB.NET ( /WPF ). The name of
the library is wpf.exontrol.EXG2ANTTLib while the name of the main component is exg2antt.
The native object may be accessed through the object itself so it is
of wpf.exontrol.EXG2ANTTLib.exg2antt type. In the editor select
the wpf.exontrol.EXG2ANTTLib.exg2antt and right click the selection, and
from the submenu select the Go To Definition.

C# ( /COM ). The name of the library is EXG2ANTTLib
while the name of the main component is G2antt. The native object may be
accessed through the GetOcx() method so G2antt1.GetOcx() is of EXG2ANTTLib.G2antt
type. Select the View\Class View and locate the Interop.EXG2ANTTLib assembly
where you can find the component's library.

C# ( /NET ). The name of the
library is exontrol.EXG2ANTTLib while the name of the main component is exg2antt.
The native object may be accessed through the object itself so it is
of exontrol.EXG2ANTTLib.exg2antt type. Select the View\Class
View and locate the exontrol.exg2antt assembly where you can find the
component's library.

C# ( /WPF). The name of the
library is wpf.exontrol.EXG2ANTTLib while the name of the main component is exg2antt.
The native object may be accessed through the object itself so it is
of wpf.xontrol.EXG2ANTTLib.exg2antt type. In the editor select
the exg2antt1 and right click the selection, and from the submenu select the
Go To Definition, and so on

C++ (6.0). The ClassWizard generates the class CG2antt, for
the component, so you may refer the component using this class. The same you
can generate the wrapper classes using the #import <exg2antt.dl> as
explained in the C++ ( 2005 )/

Add the new function init and defines one parameter of the
olecustomcontrol, while in your code you should call such as
init(ole_1).

dBASE Plus. dBASE does not require specifying the type for an OLE Object
as it is found at running time. The native object for an ActiveX can be
accessed through the nativeObject property. The init function may looks as
follow:

Visual DataFlex. VFD does not require specifying the type for an OLE Object
as it is found at running time. The Self keyword inside the object class,
determines the handle to work with as in the init function that follows:

Procedure init Handle g
Variant vColumns
Get ComColumns of g to vColumns
Handle hoColumns
Get Create (RefClass(cComColumns)) to hoColumns
Set pvComObject of hoColumns to vColumns
Get ComAdd of hoColumns "Tasks" to Nothing
Send Destroy to hoColumns
Variant vItems
Get ComItems of g to vItems
Handle hoItems
Get Create (RefClass(cComItems)) to hoItems
Set pvComObject of hoItems to vItems
Get ComAddItem of hoItems "Task 1" to Nothing
Get ComAddItem of hoItems "Task 2" to Nothing
Send Destroy to hoItems
End_Procedure

The init method can be called as follows:

Procedure OnCreate
Forward Send OnCreate
Send init Self
End_Procedure

Xbase++ It does not require specifying the type for an OLE Object
as it is found at running time:

Now, let's see how we can print the control's content.
The eXPrint component provides
print and print preview capabilities for our UI components. First, we need
to insert the exprint component to the form or dialog. For WPF Components, you
should use the eXPrint/NET component to perform print and print-preview for
the WPF component. Go Back.

If you are using the /COM version you can ALWAYS invokes the control's
Print and Print Preview using the following code, no matter of your
programming language, of your development environment such as Unipaas,
SmallTalk, and so on

In other words, just call the Template property of the control with
specified string ( red string ) , as you would change the control's Background
color.

The eXPrint component provides the PrintExt
and PrintExts
( starting from 6.1 ) properties, that allows you to specify a single
object/component to be printed, or a collection of objects to be printed
in a single document.

Access. Click the More Controls icon in the Toolbox, locate and
select the ExPrint
ActiveX Control in the shortcut menu being opened. Click the form and drag
the cursor to a new position, so the control is being inserted to your form.

VB6. Select the Project\Components (CTRL+T) and locate the ExPrint Control Library, check it, and click the OK button. The
Print icon is shown in
the Toolbox, double click it or select and put it to your form.

VFP. Select Tools\Options\Controls and locate the ExPrint
ActiveX Control in Selected list box. Check it, and click the Set As
Default, then click OK. The ExPrint icon is shown in the Form Controls
toolbox, click it, so the cursor is changed, go to the for and put it (
click and drag the cursor to a new position ).

VB.NET ( /COM ). Right click the Toolbox, select the
Choose Items, and then select the COM Components page, locate the
ExPrint ActiveX Control, check it, and click ok. The toolbox includes
the ExPrint ActiveX Control icon, double click it.

VB.NET ( /NET ). Right click the Toolbox, select the Choose
Items, and then select the .NET Framework Components page, click the
Browse button, so the Open file dialog is shown. Locate the
exontrol.exprint.dll ( usually it goes to the C:\Program Files\Exontrol\ExPrint.NET
folder ), select it, and click OK, so the .NET Framework Components list
displays a new checked items called exprint. Click ok. The toolbox includes
the exprint icon, double click it.

VB.NET ( /WPF ). You need to
add a reference to the exontrol.exprint.dll. Select the Application on the
Solution page, Right Click, and from submenu select the Add Reference ...
Click the Browse page, and locate the exontrol.exprint.dll ( usually it goes to the C:\Program Files\Exontrol\ExPrint.NET
folder ), select it, and click OK

C# ( /COM ). Right click the Toolbox, select the Choose
Items, and then select the COM Components page, locate the ExPrint ActiveX Control, check it, and click ok. The toolbox includes the
ExPrint ActiveX Control icon, double click it.

C# ( /NET ). Right click the Toolbox, select the Choose
Items, and then select the .NET Framework Components page, click the
Browse button, so the Open file dialog is shown. Locate the
exontrol.exprint.dll ( usually it goes to the C:\Program Files\Exontrol\ExPrint.NET
folder ), select it, and click OK, so the .NET Framework Components list
displays a new checked items called exprint. Click ok. The toolbox includes
the exprint icon, double click it.

C# ( /WPF ). You need to add
a reference to the exontrol.exprint.dll. Select the Application on the
Solution page, Right Click, and from submenu select the Add Reference ...
Click the Browse page, and locate the exontrol.exprint.dll ( usually it goes
to the C:\Program Files\Exontrol\ExPrint.NET folder ), select it, and click
OK. The References node should include the exontrol.exprint namespace.

C++ (6.0). Select the dialog where you need to insert the control. Right
click, and select the Insert ActiveX control, locate and select the
ExPrint ActiveX Control and then click ok. Invoke the MFC ClassWizard ( CTRL
+ W ), click the Member Variables page, select the IDC_PRINT1 identifier in
the Control IDs list, and click the Add Variable ... button, so a member
variable is added. Confirm the classes going to be added to your project and
select OK. Specify the name of the member variable being inserted as m_print
for instance. Click OK, and the Close the MFC ClassWizard, by clicking again
the OK button.

C++ (2005,2008). Select the dialog in design mode, where you need to insert the
control, in the Resource \ Dialog section. Right
click, and select the Insert ActiveX control, locate and select the
ExPrint ActiveX Control and then click ok. The control is
automatically added to your dialog. Select the control in design mode, and
then right click, and select the Add Variable shortcut menu, specify the
name of the variable to be created ( Variable name field ), m_print for
instance, and then click Finish button.

C++ Builder (2009). Select the "Component \Import
Component..." and then "Import ActiveX Control" or "Import .NET
Assembly", depending on what version you are about to import. If ActiveX, select the
ExPrint Control Library from the list of "Registered ActiveX Controls", and then
click Next. You will be informed of the "Generated import file", Check the
"Generate Component Wrappers", Click Next, and select "Install To Existing
Package" , Click Next, and select the package where the eXPrint should be added, and
then Click Finish, The package is generated and installed. Select the Form where you want
to insert the component, and then locate the TPrint in the ActiveX section of the IDE's
Tool Palette. Double click it or drag it to your form, so the component will be inserted
to the form.

Delphi (2009). Select the "Component \Import Component..."
and then "Import ActiveX Control" or "Import .NET Assembly", depending
on what version you are about to import. If ActiveX, select the ExPrint Control Library
from the list of "Registered ActiveX Controls", and then click Next. You will be
informed of the "Generated import file", Check the "Generate Component
Wrappers", Click Next, and select "Install To Existing Package" , Click
Next, and select the package where the eXPrint should be added, and then
Click Finish, The
package is generated and installed. Select the Form where you want to insert the
component, and then locate the TPrint in the ActiveX section of the IDE's Tool Palette.
Double click it or drag it to your form, so the component will be inserted to the form.

X++ (Dynamics Ax 2009) Click the Application Object Tree (AOT), so
the AOT window is opened. Open the Forms folder, and then create a new form,
or select an existing one. Expands the form being selected, so you can see
the Designs item, and locate the Design node. Right-click the Design node for the form, and then select New Control.
Select ActiveX from the submenu. Choose the control that you want to insert,
in our case, ExPrint ActiveX Control. Click the Properties of the newly
ActiveX member inserted, and go to the Name and type exprint1, so you assign
a name for your component. Specify the Visible property of the exprint1 on
False, so it won't be visible at runtime ( it is a windowless control ).

Clarion: Choose Ole control from Control template toolbar. In Object
type enter: Exontrol.Print.1. Be shure that OCX is ticked, and EVENT Handler,
too. Name it ?Print.

PowerBuilder (Classic): There are 2
options to do print and print-preview for the component. The first one is
adding the ExPrint component to the same Window where the gantt control is,
or using the CREATE OLEObject like explained in the code section. If you
choose adding eXPrint to the same Window, select the Insert\Control\Ole...
and then select Insert Control from the Insert Object dialog, and double
click the ExPrint ActiveX Control from Control Type list. Rename the name of
the newly inserted object with OPrint.

dBASE Plus: There are 2
options to do print and print-preview for the component. The first one is
adding the ExPrint component to the same form where the gantt control is as
you did for ExG2antt control,
or using the new OleAutoClient like explained in the code section.

Visual DataFlex: There are 2
options to do print and print-preview for the component. The first one using
the Template property, the second is by importing the ExPrint component to
your workspace.

Xbase++: There are 2
options to do print and print-preview for the component. The first one using
the Template property, the second is by crating and using the the ExPrint component to
your project.

Next step required in order to print or print preview our data, is to set the
PrintExt method and then call the Preview or DoPrint method as follows.

Access. The Object method of the G2antt1 object gets the native or
the original component.

Private Sub callPreview()
With Print1
Set .PrintExt = G2antt1.Object
.preview
End With
End Sub

VB6. The Object method of the G2antt1 object gets the native or the
original component.

Private Sub callPreview()
With Print1
Set .PrintExt = G2antt1.Object
.Preview
End With
End Sub

VFP. The Object method of the G2antt1 object gets the native or the
original component.

C++ (6.0). The m_print member of the CWindowMFCDlg class, is of CExPrint
type ( which has been defined by the class wizard ). The m_g2antt member is
of CG2antt type that has been defined by the class wizard. The GetControlUnknown
method retrieves a pointer to IUnknown interface being implemented by the
original component, which is the pointer required by the PrintExt method
before calling the Preview or DoPrint method of the eXPrint component.

C++ (2005,2008). The m_print member of the CWindowMFCDlg class, is of
CExPrint type ( which has been defined by the class wizard ). The m_g2antt
member is of CG2antt type that has been defined by the class wizard. The GetControlUnknown
method retrieves a pointer to IUnknown interface being implemented by the
original component, which is the pointer required by the PrintExt method
before calling the Preview or DoPrint method of the eXPrint component.

C++ Builder (2009). The DefaultDispatch function of the TOleControl
retrieves the original object, so it can be passed to PrintExt function of the eXPrint in
order to print or print preview the component, as seen in the callpreview function:

Delphi (2009). The DefaultDispatch function of the TOleControl
retrieves the original object, so it can be passed to PrintExt function of the eXPrint in
order to print or print preview the component, as seen in the callpreview function:

PowerBuilder (Classic). The Object property of the control (OLECustomControl)
returns the OLE object to be passed to PrintExt property of the eXPrint
like in the following code:

Defines the callPreview new function with one argument g of
OLECustomControl type. The print object indicates the name of the eXPrint in
the Window. The following code, can be used when the ExPrint is added in
design mode, to the Layout page:

The following callPreview function uses the eXPrint being created at
runtime. Declare the OLEObject oPrint in the Instance Variables page, so the oPrint is known at the time the callPreview is called,
so the callPreview looks as follows:

The callPreview(ole_1) should be called to invoke the print-preview of
ole_1 object. In this case the ole_1 is the ExG2antt component hosted in the
Window.

dBASE Plus. The nativeObject property of the control (ActiveX)
returns the OLE object to be passed to PrintExt property of the eXPrint
like in the following code:

Defines the preview new method with one argument g. The OEXPRINT object
indicates the name of the eXPrint in the form. The following code, can be used when the ExPrint is added in
design mode, to the form:

while, the following call can be used to print and print-preview the
control :

CLASS::callPreview(form.Activex1.nativeObject)

where the ActiveX1 is the name of the control to be printed, in this case
is the ExG2antt Chart
ActiveX Control.

The following preview function uses the eXPrint being created at
runtime. Declare the public oPrint in as a global variable, so the oPrint is known at the time the
preview is called,
so the method shows as follows:

while, the following call can be used to print and print-preview the
control :

Send preview Self

where the Self indicates the handle of the control to be printed, in this case
is the ExG2antt Chart
ActiveX Control ( oComG2antt ). This method does not require importing the
"ExPrint 1.0 Control Library ( version 1.0 )" to your workspace.

The following method requires, importing the "ExPrint 1.0 Control
Library ( version 1.0 )" to your workspace. Check how you imported
the "ExG2antt 1.0 Control Library (version 1.0)" and do the
same.

Procedure preview Variant g
Handle hoPrint
Get Create (RefClass(cComPrint)) to hoPrint
Set ComAutoRelease of hoPrint to True
Set ComPrintExts of hoPrint to g
Send ComPreview of hoPrint
//Send Destroy to hoPrint // Prevents closing the Print object, so the Preview will not be shown. AutoRelease will release the object once the Close button is pressed
End_Procedure

while, the following call can be used to print and print-preview the
control :

Send preview (pvComObject(Self))

where the Self indicates the handle of the control to be printed, in this case
is the ExG2antt Chart
ActiveX Control ( oComG2antt ).

Xbase++ The simplest way to call the Print and
Print/Preview for the component, is using the Template property of the
control as in the following sample

while, the following call can be used to print and print-preview the
control :

_preview( oControl )

where the oControl indicates the control to be printed, in this case
is the ExG2antt Chart
ActiveX Control ( oControl ). This method does not require creating the
"ExPrint 1.0 Control Library ( version 1.0 )" to your project.

The following method requires, creating and using the Preview method of the
the "ExPrint 1.0 Control
Library ( version 1.0 )" object.

while, the following call can be used to print and print-preview the
control :

_preview( oPrint, oControl )

where the oControl indicates the the control to be printed, in this case
is the ExG2antt Chart
ActiveX Control ( oControl ), and the oPrint is the
"ExPrint 1.0 Control Library ( version 1.0 )" object created using
the following code:

Call the _preview method when you need ie clicking a button, save and run
the project. Once the +preview method is called, the 'Untitled Document'
Print Preview window is opened where you can see the preview of the control's
data. In our case, we should get a picture like follows:

All of our UI components ( /COM or ActiveX versions ), provides a Template
feature. This allows calling properties or methods of the control using a string
without compiling. For instance, a code like follows Template = "BackColor
= RGB(255,0,0)" changes the control's background color to red. The Template
script is composed by lines of instructions. Instructions are separated by
"\n\r" ( newline ) characters. Go Back.

variable = property( list of arguments
) Assigns the result of the property to a variable. The
"variable" is the name of a declared variable. The
"property" is the property name of the object in the context. The
"list or arguments" may include variables or values separated by
commas. ( Sample: h = InsertItem(0,"New Child") )

property( list of arguments )= value Changes the property. The value can
be a variable, a string, a number, a boolean value or a RGB value.

method( list of arguments )Invokes the method. The "list or arguments" may include
variables or values separated by commas.

{Beginning the object's context.
The properties or methods called between { and } are related to the last
object returned by the property prior to { declaration.

}Ending the object's context

object. property( list of arguments ).property(
list of arguments ).... The .(dot) character splits the object from its
property. For instance, the Columns.Add("Column1").HeaderBackColor
= RGB(255,0,0), adds a new column and changes the column's header back
color.

Here's the Template required to generate the same imagine as the
above code will be:

A string may be declared between " or ` as well. The '
defines comments in the x-script, so it should not be confused with " or `
characters.

The Template supports the following general functions:

RGB(R,G,B) property
retrieves a RGB value, where the R, G, B are byte values that indicates the
R G B values for the color being specified. For instance, the following code
changes the control's background color to red: BackColor = RGB(255,0,0)

CreateObject(progID)
property creates and retrieves a single uninitialized object of the class
associated with a specified program identifier.

Me retrieves the original object

LoadPicture(filename) loads a
picture from the filename and retrieves a picture object

Calling the Template property will not remove or erase the control's data
before executing, so you can call Template property several times. For instance,
you can declare a template as follow: "Items.AddItem(``)". Calling it
5 times will add actually 5 new items. The Exontrol's eXHelper
tool helps you to find easy and quickly the answers and the source code for your
questions regarding the usage of our UI components. The eXHelper toiol is able
to translate the template script to VBA, VB6, VB.NET, VFP6, VFP9, C# and C++ .

Now, let's add an event handler for the
component. For instance let's display a message box when the user clicks the
cell's check box ( so when a checkbox is being checked ), in other words, when the cell's checkbox state is changed, so
we need to handle the CellStateChanged event. Go Back.

Access. Select the component in design mode, Right Click, and then
Select the Build Event. Select the G2antt1 component in the first drop down
list, and in the second drop down list, select the CellStateChanged. The
right syntax for the selected event is being generated and added to the
code.

Private Sub G2antt1_CellStateChanged(ByVal Item As Long, ByVal ColIndex As Long)
If Not (G2antt1.Items.CellState(Item, ColIndex) = 0) Then
MsgBox "Check"
End If
End Sub

VB6. In design mode, select the component, double click it. Select
the G2antt1 component in the first drop down list, and in the second drop
down list, select the CellStateChanged. The right syntax for the selected
event is being generated and added to the code.

Private Sub G2antt1_CellStateChanged(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal ColIndex As Long)
If Not (G2antt1.Items.CellState(Item, ColIndex) = 0) Then
MsgBox "Check"
End If
End Sub

VFP. In design mode, select the component, double click it. Select
the G2antt1 component in the first drop down list ( Object ), and in the
second drop down list ( Procedure ), select the CellStateChanged. The right
syntax for the selected event is being generated and added to the code.

VB.NET ( /NET ). Select
the component in design mode, Click the Events page, in the Properties toolbox.
Locate the CellStateChanged item in the list, and double click it.

Private Sub Exg2antt1_CellStateChanged(ByVal sender As System.Object, _
ByVal Item As System.Int32, ByVal ColIndex As System.Int32) _
Handles Exg2antt1.CellStateChanged
If Not (Exg2antt1.Items.get_CellState(Item, ColIndex) = 0) Then
MessageBox.Show("Check")
End If
End Sub

VB.NET ( /WPF ). You can
add a handler for a specified event in 2 ways. The first, go to
Window1.xaml, select the my:exg2antt tag, and got to the end before />
and type space or start typing CellState... The editor opens the list or
events that you can handle, once you locate the proper one, press the TAB
key twice, so the code CellStateChanged="Exg2antt1_CellStateChanged" will be
added to the xaml code. In this moment, the Window1.xaml.vb code includes
the definition for CellStateChanged event. The second option to add a new
handler for a specified event, is: Go to Window1.xaml.vb code, in the left
top side you should drop down the objects being hosted by the Window1, so
click the left drop down, and select the Exg2antt1 node. The top-right field
should display (Declarations), there click the drop down button, and click
the desired event. An empty handler for selected event is being added to the
vb code.

Private Sub Exg2antt1_CellStateChanged(ByVal sender As System.Object, ByVal Item As System.Int32, ByVal ColIndex As System.Int32)
If Not (Exg2antt1.Items.get_CellState(Item, ColIndex) = 0) Then
MessageBox.Show("Check")
End If
End Sub

C# ( /COM ). Select the component in design mode, Click
the Events page, in the Properties toolbox. Locate the CellStateChanged item
in the list, and double click it.

C# ( /WPF ). Go to
Window1.xaml, select the my:exg2antt tag, and got to the end before />
and type space or start typing CellState... The editor opens the list or
events that you can handle, once you locate the proper one, press the TAB
key twice, so the code CellStateChanged="exg2antt1_CellStateChanged" will be
added to the xaml code. In this moment, the Window1.xaml.cs code includes
the definition for CellStateChanged event.

C++ (6.0). Select the component in design mode, Right click, and
select Events in the shortcut menu. The Windows Message and Event Handlers
for class dialog is opened. Locate the CellStateChanged item in the Window
messages/events and click the Add and Edit button. Confirm the name of the member
function, and click OK button.

C++ (2005,2008). Select the component in design mode, Right click, and
select Add Event Handler in the shortcut menu. The Event Handler Wizard
dialog is opened. Locate and select the CellStateChanged item in the Message
Type listbox, click the Add and Edit button. In the following sample we have
used, the #import <exg2antt.dll> so the
control's type library is included in the project, so the EXG2ANTTLib
namespace is defined. The EXG2ANTTLib namespace defines all objects,
properties and method of the control. The class wizard has inserted only a
class definition for the main object, not for all the objects being exposed
by the component.

X++ (Dynamics Ax 2009). In the AOT window, select the Form that
hosts our component. Expand it, so you can locate the
Designs\Design\ActiveX:exg2antt1. Right click the exg2antt node ( under the
Design node ), and select the ActiveX Explorer from the submenu, so
the list of events and methods for the ExG2antt component is displayed. In
the Event tab locate the event you need to handle, in our case search for
void onEvent_CellStateChanged(int _Item, int _ColIndex) and click the Add
and after that Edit buttons so the new event handler is being added:

IF NOT OLEControlFEQ{mc:Items&'.CellState('&OLE:Item&', '&OLE:ColIndex&')'} = 0
MESSAGE('Check')
End

PowerBuilder (Classic). Select the component (ole_1 ) in the Layout
page ( Window ), and go to the Event List page, look for cellstatechanged(
long item, long colindex ) returns (none), and double click it, so the
script window is opened. Paste there the following code:

dBASE Plus. Select the component (ActiveX1 ) in the design mode (
Form Designer ), and go to the "Inspector" tool, click the Events
page, and select the form.activex1.nativeobject in the object field to be
browsed, so the internal events are displayed, and look for CellStateChanged
and add a handler for it, so the function nativeObject_CellStateChanged(Item,
ColIndex) is added to your code. Next, paste there the following code:

Visual DataFlex. Switch to Designer, select the component, and locate the Events
page on the Properties browser. The events provided by the
component starts with OnCom, so select the OnComCellStateChanged event and
double click it so an empty handler is added to your
code. Next, paste the following code:

If you need to add any other event for the component, you should check the definition
of the event in the control's help file ( exg2antt.chm, for instance ), and
provide the parameters of the events as between ||, and the rest in the events
body between {} paranthesis.