50
How do I get the start/end of the bar once the BarResize/BarResizing event occurs

// HostEvent event - Notifies the application once the host fires an event.
procedure TForm1.G2Host1HostEvent(ASender: TObject; EventID : HostEventEnum);
begin
	with G2Host1 do
	begin
		h := HostEventParam[0];
		key := HostEventParam[1];
		OutputDebugString( HostEventParam[-2] );
		OutputDebugString( 'Start:' );
		OutputDebugString( Host.Items.ItemBar[h,OleVariant(key),1] );
		OutputDebugString( HostEventParam[-2] );
		OutputDebugString( 'End:' );
		OutputDebugString( Host.Items.ItemBar[h,OleVariant(key),2] );
	end
end;

with G2Host1 do
begin
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart do
	begin
		PaneWidth[False] := 128;
		FirstVisibleDate := '3/30/2019';
	end;
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items do
	begin
		AddBar(AddItem('Task'),'Task','4/1/2019','4/14/2019',Null,Null);
	end;
end
49
How do I get the bar/task from the cursor
// HostEvent event - Notifies the application once the host fires an event.
procedure TForm1.G2Host1HostEvent(ASender: TObject; EventID : HostEventEnum);
begin
	with G2Host1 do
	begin
		OutputDebugString( 'Event:' );
		OutputDebugString( HostEventParam[-2] );
		with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
		begin
			i := ItemFromPoint[-1,-1,c,h];
			OutputDebugString( 'Cell:' );
			OutputDebugString( Items.CellCaption[OleVariant(i),OleVariant(c)] );
			with Chart do
			begin
				b := BarFromPoint[-1,1];
				OutputDebugString( 'Bar:' );
				OutputDebugString( (IUnknown(G2Host1.Host) as EXG2ANTTLib_TLB.G2antt).Items.ItemBar[i,OleVariant(b),0] );
			end;
		end;
	end
end;


48
How do I get the cell from the cursor

// HostEvent event - Notifies the application once the host fires an event.
procedure TForm1.G2Host1HostEvent(ASender: TObject; EventID : HostEventEnum);
begin
	with G2Host1 do
	begin
		OutputDebugString( 'Event:' );
		OutputDebugString( HostEventParam[-2] );
		with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
		begin
			i := ItemFromPoint[-1,-1,c,h];
			OutputDebugString( 'Cell:' );
			OutputDebugString( Items.CellCaption[OleVariant(i),OleVariant(c)] );
		end;
	end
end;


47
How can I highlights cells based on its value

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataField[EXG2HOSTLib_TLB.exTasksColor] := 'Color';
	DataField[EXG2HOSTLib_TLB.exTasksCaption] := 'TaskName';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		BeginUpdate();
		BackColorAlternate := $0;
		with Columns.Item['Title'] do
		begin
			Def[4] := OleVariant(15790320);
			Width := AutoWidth;
		end;
		with ConditionalFormats do
		begin
			Add('lower(%4) contains `manager`',Null).Bold := True;
			Add('%3',Null).BackColor := $f0f0f0;
		end;
		Items.ExpandItem[0] := True;
		with Columns.Item['EmployeeID'] do
		begin
			Width := AutoWidth;
		end;
		EndUpdate();
	end;
end
46
How do I programatically hide a column

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataField[EXG2HOSTLib_TLB.exTasksColor] := 'Color';
	DataField[EXG2HOSTLib_TLB.exTasksCaption] := 'TaskName';
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Columns.Item['LastName'].Visible := False;
end
45
Is it possible to get the information from the control when we click on the bar/item

// HostEvent event - Notifies the application once the host fires an event.
procedure TForm1.G2Host1HostEvent(ASender: TObject; EventID : HostEventEnum);
begin
	with G2Host1 do
	begin
		OutputDebugString( HostEventParam[-2] );
		with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
		begin
			i := ItemFromPoint[-1,-1,c,hit];
			OutputDebugString( 'cell''s value from cursor: ' );
			OutputDebugString( Items.CellValue[OleVariant(i),OleVariant(c)] );
			OutputDebugString( 'cell''s value on col 1: ' );
			OutputDebugString( Items.CellValue[OleVariant(i),OleVariant(1)] );
			b := Chart.BarFromPoint[-1,-1];
			OutputDebugString( 'Bar:' );
			OutputDebugString( b );
			OutputDebugString( 'Bar Start:' );
			OutputDebugString( Items.ItemBar[i,OleVariant(b),1] );
			OutputDebugString( 'Bar End:' );
			OutputDebugString( Items.ItemBar[i,OleVariant(b),2] );
			OutputDebugString( 'Bar Caption:' );
			OutputDebugString( Items.ItemBar[i,OleVariant(b),3] );
		end;
	end
end;

with G2Host1 do
begin
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		Debug := True;
		with Chart.Bars.Item['Task'] do
		begin
			OverlaidType := Integer(EXG2ANTTLib_TLB.exOverlaidBarsStackAutoArrange) Or Integer(EXG2ANTTLib_TLB.exOverlaidBarsStack);
			OverlaidGroup := 'Task,Progress';
		end;
	end;
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataField[EXG2HOSTLib_TLB.exTasksColor] := 'Color';
	DataField[EXG2HOSTLib_TLB.exTasksCaption] := 'TaskName';
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items.ExpandItem[0] := True;
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart do
	begin
		PaneWidth[False] := 128;
		ScrollTo('5/27/2017',OleVariant(1));
	end;
end
44
How do I get the bar from the cursor

// HostEvent event - Notifies the application once the host fires an event.
procedure TForm1.G2Host1HostEvent(ASender: TObject; EventID : HostEventEnum);
begin
	with G2Host1 do
	begin
		OutputDebugString( HostEventParam[-2] );
		OutputDebugString( Host.Chart.BarFromPoint[-1,-1] );
	end
end;

with G2Host1 do
begin
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		VisualAppearance.Add(1,'C:\Program Files\Exontrol\ExG2Host\Sample\EBN\Assorted\wbs-ass.ebn');
		with Chart.Bars.Item['Task'] do
		begin
			Height := 15;
			Color := $1ff0000;
			OverlaidType := Integer(EXG2ANTTLib_TLB.exOverlaidBarsStackAutoArrange) Or Integer(EXG2ANTTLib_TLB.exOverlaidBarsStack);
			OverlaidGroup := 'Task,Progress';
		end;
	end;
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataField[EXG2HOSTLib_TLB.exTasksColor] := 'Color';
	DataField[EXG2HOSTLib_TLB.exTasksCaption] := 'TaskName';
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items.ExpandItem[0] := True;
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart do
	begin
		PaneWidth[False] := 128;
		ScrollTo('5/27/2017',OleVariant(1));
	end;
end
43
How do I add Start/End columns

// HostEvent event - Notifies the application once the host fires an event.
procedure TForm1.G2Host1HostEvent(ASender: TObject; EventID : HostEventEnum);
begin
	with G2Host1 do
	begin
		OutputDebugString( HostEventParam[-2] );
	end
end;

with G2Host1 do
begin
	HostReadOnly := Integer(EXG2HOSTLib_TLB.exHostReadWrite) Or Integer(EXG2HOSTLib_TLB.exHostAllowAddEmptyItem);
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		SingleSel := False;
		OnResizeControl := 1;
		ScrollBars := Integer(EXG2ANTTLib_TLB.exVScrollEmptySpace) Or Integer(EXG2ANTTLib_TLB.exDisableNoVertical);
		with (IUnknown(Columns.Add('Start')) as EXG2ANTTLib_TLB.Column) do
		begin
			AllowSizing := False;
			Def[18] := OleVariant(1);
			Editor.EditType := 7;
		end;
		with (IUnknown(Columns.Add('End')) as EXG2ANTTLib_TLB.Column) do
		begin
			AllowSizing := False;
			Def[18] := OleVariant(2);
			Editor.EditType := 7;
		end;
		Items.AllowCellValueToItemBar := True;
		with Chart do
		begin
			AllowCreateBar := 1;
			PaneWidth[False] := 256;
			Bars.Item['Task'].OverlaidType := Integer(EXG2ANTTLib_TLB.exOverlaidBarsStackAutoArrange) Or Integer(EXG2ANTTLib_TLB.exOverlaidBarsStack);
		end;
	end;
end
42
How do I hide the left/items/columns part of the control

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.Bars.Item['Task'] do
	begin
		Pattern := 1;
		Color := $ff0000;
		Def[19] := OleVariant(50);
	end;
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataField[EXG2HOSTLib_TLB.exTasksColor] := 'Color';
	DataField[EXG2HOSTLib_TLB.exTasksCaption] := 'TaskName';
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items.ExpandItem[0] := True;
	HostReadOnly := Integer(EXG2HOSTLib_TLB.exHostReadWrite) Or Integer(EXG2HOSTLib_TLB.exHostAllowAddEmptyItem);
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		OnResizeControl := Integer(EXG2ANTTLib_TLB.exDisableSplitter) Or Integer(EXG2ANTTLib_TLB.exResizeChart);
		with Chart do
		begin
			ColumnsFormatLevel := '1';
			PaneWidth[False] := 0;
			ScrollTo('5/27/2017',OleVariant(1));
		end;
	end;
end
41
How do I hide the right/chart/tasks part of the control

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.Bars.Item['Task'] do
	begin
		Pattern := 1;
		Color := $ff0000;
		Def[19] := OleVariant(50);
	end;
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataField[EXG2HOSTLib_TLB.exTasksColor] := 'Color';
	DataField[EXG2HOSTLib_TLB.exTasksCaption] := 'TaskName';
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items.ExpandItem[0] := True;
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		with Chart do
		begin
			PaneWidth[True] := 0;
			OverviewVisible := 0;
		end;
	end;
end
40
How do hide the top/overview part of the control

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := DataField[EXG2HOSTLib_TLB.exItemsDataSource];
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'BirthDate';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'HireDate';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		with Chart do
		begin
			OverviewVisible := 0;
			PaneWidth[False] := 256;
			ScrollTo('4/27/1969',OleVariant(1));
		end;
	end;
end
39
How do I resize the panels

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		VisualAppearance.Add(1,'C:\Program Files\Exontrol\ExG2Host\Sample\EBN\Assorted\wbs-ass.ebn');
		with Chart.Bars.Item['Task'] do
		begin
			Height := 15;
			Color := $1ff0000;
			OverlaidType := Integer(EXG2ANTTLib_TLB.exOverlaidBarsStackAutoArrange) Or Integer(EXG2ANTTLib_TLB.exOverlaidBarsStack);
			OverlaidGroup := 'Task,Progress';
		end;
	end;
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataField[EXG2HOSTLib_TLB.exTasksColor] := 'Color';
	DataField[EXG2HOSTLib_TLB.exTasksCaption] := 'TaskName';
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items.ExpandItem[0] := True;
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart do
	begin
		PaneWidth[False] := 128;
		ScrollTo('5/27/2017',OleVariant(1));
	end;
end
38
How do I lock the first column

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		CountLockedColumns := 1;
		BackColorLock := BackColorAlternate;
	end;
end
37
How do I specify a different color for the tasks ( EBN color )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		VisualAppearance.Add(1,'C:\Program Files\Exontrol\ExG2Host\Sample\EBN\Assorted\wbs-ass.ebn');
		with Chart.Bars.Item['Task'] do
		begin
			Height := 15;
			Color := $1ff0000;
			OverlaidType := Integer(EXG2ANTTLib_TLB.exOverlaidBarsStackAutoArrange) Or Integer(EXG2ANTTLib_TLB.exOverlaidBarsStack);
			OverlaidGroup := 'Task,Progress';
		end;
	end;
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataField[EXG2HOSTLib_TLB.exTasksColor] := 'Color';
	DataField[EXG2HOSTLib_TLB.exTasksCaption] := 'TaskName';
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items.ExpandItem[0] := True;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.PaneWidth[False] := 256;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.ScrollTo('5/27/2017',OleVariant(1));
end
36
How do I specify a different color for the tasks ( solid color, transparent )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.Bars.Item['Task'] do
	begin
		Pattern := 1;
		Color := $ff0000;
		Def[19] := OleVariant(50);
	end;
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataField[EXG2HOSTLib_TLB.exTasksColor] := 'Color';
	DataField[EXG2HOSTLib_TLB.exTasksCaption] := 'TaskName';
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items.ExpandItem[0] := True;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.PaneWidth[False] := 256;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.ScrollTo('5/27/2017',OleVariant(1));
end
35
GroupBy

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataSource['Links'] := DataSource['Items'];
	DataMember['Links'] := 'EmployeeLinks';
	DataField[EXG2HOSTLib_TLB.exLinksDataSource] := 'Links';
	DataField[EXG2HOSTLib_TLB.exLinksStart] := 'Start';
	DataField[EXG2HOSTLib_TLB.exLinksEnd] := 'End';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		AllowGroupBy := True;
		SortBarVisible := True;
		BackColorSortBar := (IUnknown(G2Host1.Host) as EXG2ANTTLib_TLB.G2antt)BackColor;
		BackColorSortBarCaption := BackColorSortBar;
		SortBarCaption := '<sha ;;0><fgcolor=FF0000>Drag a <b>column</b> header here to sort by that column.';
		with Chart.Bars.Item['Task'] do
		begin
			OverlaidType := Integer(EXG2ANTTLib_TLB.exOverlaidBarsStackAutoArrange) Or Integer(EXG2ANTTLib_TLB.exOverlaidBarsStack);
			OverlaidGroup := 'Task,Progress';
		end;
		Items.ExpandItem[0] := True;
		CountLockedColumns := 1;
		BackColorLock := BackColorAlternate;
		with Columns.Item['EmployeeID'] do
		begin
			AllowGroupBy := False;
			Def[7] := OleVariant((IUnknown(G2Host1.Host) as EXG2ANTTLib_TLB.G2antt).BackColorAlternate);
		end;
		Columns.Item['Title'].SortOrder := 1;
	end;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.ScrollTo('5/27/2017',OleVariant(1));
end
34
How can I hide a column
// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Columns.Item[OleVariant(0)].Visible := False;
end
33
Can row errors being highligted until the user correct them, not to clear them as soon a change occurs

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	HostDef[EXG2HOSTLib_TLB.exErrorClearOnChange] := OleVariant(False);
end
32
No error is highligthed

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
end
31
I've noticed that rows with errors are shown in red. Is it possible to change the colors

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	HostDef[EXG2HOSTLib_TLB.exErrorBackColor] := OleVariant(0);
	HostDef[EXG2HOSTLib_TLB.exErrorForeColor] := OleVariant(16777215);
end
30
Is it possible to rename the (New) to something else

with G2Host1 do
begin
	HostDef[EXG2HOSTLib_TLB.exNew] := '*';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		BeginUpdate();
		Items.AddItem('A');
		Items.AddItem('B');
		EndUpdate();
	end;
	Refresh();
end
29
How can I hide the (New) item (sample 2)

with G2Host1 do
begin
	HostReadOnly := Integer(EXG2HOSTLib_TLB.exHostAllowUpdate) Or Integer(EXG2HOSTLib_TLB.exHostAllowDelete);
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		BeginUpdate();
		Items.AddItem('A');
		Items.AddItem('B');
		EndUpdate();
	end;
end
28
How can I hide the (New) item (sample 1)

with G2Host1 do
begin
	HostDef[EXG2HOSTLib_TLB.exNew] := '';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		BeginUpdate();
		Items.AddItem('A');
		Items.AddItem('B');
		EndUpdate();
	end;
	Refresh();
end
27
Read-Only

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	HostReadOnly := EXG2HOSTLib_TLB.exHostReadOnly;
end
26
How can I prevent user create new /delete tasks ( only move or resize then )
// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataSource['Links'] := DataSource['Items'];
	DataMember['Links'] := 'EmployeeLinks';
	DataField[EXG2HOSTLib_TLB.exLinksDataSource] := 'Links';
	DataField[EXG2HOSTLib_TLB.exLinksStart] := 'Start';
	DataField[EXG2HOSTLib_TLB.exLinksEnd] := 'End';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.Bars.Item['Task'] do
	begin
		OverlaidType := Integer(EXG2ANTTLib_TLB.exOverlaidBarsStackAutoArrange) Or Integer(EXG2ANTTLib_TLB.exOverlaidBarsStack);
		OverlaidGroup := 'Task,Progress';
	end;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items.ExpandItem[0] := True;
	HostReadOnly := EXG2HOSTLib_TLB.exHostAllowUpdate;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.ScrollTo('5/27/2017',OleVariant(1));
end
25
How do I get the row/item/task/link from the cursor

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

// HostEvent event - Notifies the application once the host fires an event.
procedure TForm1.G2Host1HostEvent(ASender: TObject; EventID : HostEventEnum);
begin
	with G2Host1 do
	begin
		OutputDebugString( HostContext.ToString );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	HostReadOnly := Integer(EXG2HOSTLib_TLB.exHostAllowUpdate) Or Integer(EXG2HOSTLib_TLB.exHostAllowAddNew);
end
24
Disable Delete
// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	HostReadOnly := Integer(EXG2HOSTLib_TLB.exHostAllowUpdate) Or Integer(EXG2HOSTLib_TLB.exHostAllowAddNew);
end
23
Disable AddNew

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	HostReadOnly := Integer(EXG2HOSTLib_TLB.exHostAllowUpdate) Or Integer(EXG2HOSTLib_TLB.exHostAllowDelete);
end
22
ACCDB sample ( file )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataSource['Links'] := DataSource['Items'];
	DataMember['Links'] := 'EmployeeLinks';
	DataField[EXG2HOSTLib_TLB.exLinksDataSource] := 'Links';
	DataField[EXG2HOSTLib_TLB.exLinksStart] := 'Start';
	DataField[EXG2HOSTLib_TLB.exLinksEnd] := 'End';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.Bars.Item['Task'] do
	begin
		OverlaidType := Integer(EXG2ANTTLib_TLB.exOverlaidBarsStackAutoArrange) Or Integer(EXG2ANTTLib_TLB.exOverlaidBarsStack);
		OverlaidGroup := 'Task,Progress';
	end;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items.ExpandItem[0] := True;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.ScrollTo('5/27/2017',OleVariant(1));
end
21
MDB sample ( file )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.mdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataSource['Links'] := DataSource['Items'];
	DataMember['Links'] := 'EmployeeLinks';
	DataField[EXG2HOSTLib_TLB.exLinksDataSource] := 'Links';
	DataField[EXG2HOSTLib_TLB.exLinksStart] := 'Start';
	DataField[EXG2HOSTLib_TLB.exLinksEnd] := 'End';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.Bars.Item['Task'] do
	begin
		OverlaidType := Integer(EXG2ANTTLib_TLB.exOverlaidBarsStackAutoArrange) Or Integer(EXG2ANTTLib_TLB.exOverlaidBarsStack);
		OverlaidGroup := 'Task,Progress';
	end;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items.ExpandItem[0] := True;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.ScrollTo('5/27/2017',OleVariant(1));
end
20
DBF sample ( file )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.dbf';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
end
19
DAO sample ( object, DAO.DBEngine.120, multiple tasks, multiple tables )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	with (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('DAO.DBEngine.120'))) as DAO_TLB.PrivDBEngine) do
	begin
		with OpenDatabase('C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb',Null,Null,Null) do
		begin
			rsEmployees := (IUnknown(OpenRecordset('Employees',Null,Null,Null)) as DAO_TLB.Recordset2);
			rsTasks := (IUnknown(OpenRecordset('EmployeeDetails',Null,Null,Null)) as DAO_TLB.Recordset2);
			rsLinks := (IUnknown(OpenRecordset('EmployeeLinks',Null,Null,Null)) as DAO_TLB.Recordset2);
		end;
	end;
	DataSource['Items'] := (IUnknown(rsEmployees) as DAO_TLB.Recordset2);
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataSource['Tasks'] := (IUnknown(rsTasks) as DAO_TLB.Recordset2);
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataSource['Links'] := (IUnknown(rsLinks) as DAO_TLB.Recordset2);
	DataField[EXG2HOSTLib_TLB.exLinksDataSource] := 'Links';
	DataField[EXG2HOSTLib_TLB.exLinksStart] := 'Start';
	DataField[EXG2HOSTLib_TLB.exLinksEnd] := 'End';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.Bars.Item['Task'] do
	begin
		OverlaidType := Integer(EXG2ANTTLib_TLB.exOverlaidBarsStackAutoArrange) Or Integer(EXG2ANTTLib_TLB.exOverlaidBarsStack);
		OverlaidGroup := 'Task,Progress';
	end;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items.ExpandItem[0] := True;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.ScrollTo('5/27/2017',OleVariant(1));
end
18
DAO sample ( file, multiple tasks, multiple tables )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataTechnology['Items'] := 'DAO.DBEngine.120;DAO.DBEngine.36';
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataTechnology['Tasks'] := 'DAO.DBEngine.120;DAO.DBEngine.36';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataTechnology['Links'] := 'DAO.DBEngine.120;DAO.DBEngine.36';
	DataSource['Links'] := DataSource['Items'];
	DataMember['Links'] := 'EmployeeLinks';
	DataField[EXG2HOSTLib_TLB.exLinksDataSource] := 'Links';
	DataField[EXG2HOSTLib_TLB.exLinksStart] := 'Start';
	DataField[EXG2HOSTLib_TLB.exLinksEnd] := 'End';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.Bars.Item['Task'] do
	begin
		OverlaidType := Integer(EXG2ANTTLib_TLB.exOverlaidBarsStackAutoArrange) Or Integer(EXG2ANTTLib_TLB.exOverlaidBarsStack);
		OverlaidGroup := 'Task,Progress';
	end;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items.ExpandItem[0] := True;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.ScrollTo('5/27/2017',OleVariant(1));
end
17
DAO sample ( object, DAO.DBEngine.120, single task, single table )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	with (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('DAO.DBEngine.120'))) as DAO_TLB.PrivDBEngine) do
	begin
		with OpenDatabase('C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb',Null,Null,Null) do
		begin
			rsEmployees := (IUnknown(OpenRecordset('Employees',Null,Null,Null)) as DAO_TLB.Recordset2);
			rsLinks := (IUnknown(OpenRecordset('EmployeeLinks',Null,Null,Null)) as DAO_TLB.Recordset2);
		end;
	end;
	DataSource['Items'] := (IUnknown(rsEmployees) as DAO_TLB.Recordset2);
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := DataField[EXG2HOSTLib_TLB.exItemsDataSource];
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'BirthDate';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'HireDate';
	DataSource['Links'] := (IUnknown(rsLinks) as DAO_TLB.Recordset2);
	DataField[EXG2HOSTLib_TLB.exLinksDataSource] := 'Links';
	DataField[EXG2HOSTLib_TLB.exLinksStart] := 'Start';
	DataField[EXG2HOSTLib_TLB.exLinksEnd] := 'End';
end
16
DAO sample ( file, single task, single table )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataTechnology['Items'] := 'DAO.DBEngine.120;DAO.DBEngine.36';
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := DataField[EXG2HOSTLib_TLB.exItemsDataSource];
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'BirthDate';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'HireDate';
	DataTechnology['Links'] := 'DAO.DBEngine.120;DAO.DBEngine.36';
	DataSource['Links'] := DataSource['Items'];
	DataMember['Links'] := 'EmployeeLinks';
	DataField[EXG2HOSTLib_TLB.exLinksDataSource] := 'Links';
	DataField[EXG2HOSTLib_TLB.exLinksStart] := 'Start';
	DataField[EXG2HOSTLib_TLB.exLinksEnd] := 'End';
end
15
DAO sample ( tree recordset )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataTechnology['Items'] := 'DAO.DBEngine.120;DAO.DBEngine.36';
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
end
14
DAO sample ( flat recordset )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	with (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('DAO.DBEngine.120'))) as DAO_TLB.PrivDBEngine) do
	begin
		with OpenDatabase('C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb',Null,Null,Null) do
		begin
			rsEmployees := (IUnknown(OpenRecordset('Employees',Null,Null,Null)) as DAO_TLB.Recordset2);
		end;
	end;
	DataSource['Items'] := (IUnknown(rsEmployees) as DAO_TLB.Recordset2);
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
end
13
DAO sample ( flat )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataTechnology['Items'] := 'DAO.DBEngine.120;DAO.DBEngine.36';
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
end
12
ADO sample ( object, ADODB.Recordset, multiple tasks )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	rsEmployees := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADODB.Recordset'))) as ADODB_TLB.Recordset);
	rsEmployees.Open('Employees','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb',3,3,Null);
	DataSource['Items'] := (IUnknown(rsEmployees) as ADODB_TLB.Recordset);
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	rsTasks := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADODB.Recordset'))) as ADODB_TLB.Recordset);
	rsTasks.Open('EmployeeDetails','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb',3,3,Null);
	DataSource['Tasks'] := (IUnknown(rstasks) as ADODB_TLB.Recordset);
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	rsLinks := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADODB.Recordset'))) as ADODB_TLB.Recordset);
	rsLinks.Open('EmployeeLinks','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb',3,3,Null);
	DataSource['Links'] := (IUnknown(rsLinks) as ADODB_TLB.Recordset);
	DataField[EXG2HOSTLib_TLB.exLinksDataSource] := 'Links';
	DataField[EXG2HOSTLib_TLB.exLinksStart] := 'Start';
	DataField[EXG2HOSTLib_TLB.exLinksEnd] := 'End';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.Bars.Item['Task'] do
	begin
		OverlaidType := Integer(EXG2ANTTLib_TLB.exOverlaidBarsStackAutoArrange) Or Integer(EXG2ANTTLib_TLB.exOverlaidBarsStack);
		OverlaidGroup := 'Task,Progress';
	end;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items.ExpandItem[0] := True;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.ScrollTo('5/27/2017',OleVariant(1));
end
11
ADO sample ( file, multiple tasks, multiple tables )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataTechnology['Items'] := 'ADODB.Recordset;ADOR.Recordset';
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataTechnology['Tasks'] := 'ADODB.Recordset;ADOR.Recordset';
	DataSource['Tasks'] := DataSource['Items'];
	DataMember['Tasks'] := 'EmployeeDetails';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := 'Tasks';
	DataField[EXG2HOSTLib_TLB.exTasksItemID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'DateStart';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'DateEnd';
	DataField[EXG2HOSTLib_TLB.exTasksID] := 'TaskID';
	DataTechnology['Links'] := 'ADODB.Recordset;ADOR.Recordset';
	DataSource['Links'] := DataSource['Items'];
	DataMember['Links'] := 'EmployeeLinks';
	DataField[EXG2HOSTLib_TLB.exLinksDataSource] := 'Links';
	DataField[EXG2HOSTLib_TLB.exLinksStart] := 'Start';
	DataField[EXG2HOSTLib_TLB.exLinksEnd] := 'End';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.Bars.Item['Task'] do
	begin
		OverlaidType := Integer(EXG2ANTTLib_TLB.exOverlaidBarsStackAutoArrange) Or Integer(EXG2ANTTLib_TLB.exOverlaidBarsStack);
		OverlaidGroup := 'Task,Progress';
	end;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Items.ExpandItem[0] := True;
	(IUnknown(Host) as EXG2ANTTLib_TLB.G2antt).Chart.ScrollTo('5/27/2017',OleVariant(1));
end
10
ADO sample ( object, ADODB.Recordset, single task, single table )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	rsEmployees := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADODB.Recordset'))) as ADODB_TLB.Recordset);
	rsEmployees.Open('Employees','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb',3,3,Null);
	DataSource['Items'] := (IUnknown(rsEmployees) as ADODB_TLB.Recordset);
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := DataField[EXG2HOSTLib_TLB.exItemsDataSource];
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'BirthDate';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'HireDate';
	rsLinks := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADODB.Recordset'))) as ADODB_TLB.Recordset);
	rsLinks.Open('EmployeeLinks','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb',3,3,Null);
	DataSource['Links'] := (IUnknown(rsLinks) as ADODB_TLB.Recordset);
	DataField[EXG2HOSTLib_TLB.exLinksDataSource] := 'Links';
	DataField[EXG2HOSTLib_TLB.exLinksStart] := 'Start';
	DataField[EXG2HOSTLib_TLB.exLinksEnd] := 'End';
end
9
ADO sample ( file, single task, single table )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataTechnology['Items'] := 'ADODB.Recordset;ADOR.Recordset';
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
	DataField[EXG2HOSTLib_TLB.exTasksDataSource] := DataField[EXG2HOSTLib_TLB.exItemsDataSource];
	DataField[EXG2HOSTLib_TLB.exTasksStart] := 'BirthDate';
	DataField[EXG2HOSTLib_TLB.exTasksEnd] := 'HireDate';
	DataTechnology['Links'] := 'ADODB.Recordset;ADOR.Recordset';
	DataSource['Links'] := DataSource['Items'];
	DataMember['Links'] := 'EmployeeLinks';
	DataField[EXG2HOSTLib_TLB.exLinksDataSource] := 'Links';
	DataField[EXG2HOSTLib_TLB.exLinksStart] := 'Start';
	DataField[EXG2HOSTLib_TLB.exLinksEnd] := 'End';
end
8
ADO sample ( tree recordset )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataTechnology['Items'] := 'ADODB.Recordset;ADOR.Recordset';
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	DataField[EXG2HOSTLib_TLB.exItemsID] := 'EmployeeID';
	DataField[EXG2HOSTLib_TLB.exItemsParentID] := 'ReportsTo';
end
7
ADO sample ( flat recordset )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	rsEmployees := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('ADODB.Recordset'))) as ADODB_TLB.Recordset);
	rsEmployees.Open('Employees','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb',3,3,Null);
	DataSource['Items'] := (IUnknown(rsEmployees) as ADODB_TLB.Recordset);
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
end
6
ADO sample ( flat table )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataTechnology['Items'] := 'ADODB.Recordset;ADOR.Recordset';
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.accdb';
	DataMember['Items'] := 'Employees';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
end
5
XML sample ( object, MSXML.DOMDocument )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	xml := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('MSXML.DOMDocument'))) as MSXML2_TLB.FreeThreadedDOMDocument30);
	xml.async := False;
	xml.load('C:\Program Files\Exontrol\ExG2Host\Sample\sample.xml');
	DataSource['Items'] := (IUnknown(xml) as MSXML2_TLB.FreeThreadedDOMDocument30);
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		LinesAtRoot := -1;
		SingleSel := False;
		AutoDrag := 3;
	end;
end
4
XML sample ( file tree )

// Error event - Fired when an internal error occurs.
procedure TForm1.G2Host1Error(ASender: TObject; Error : Integer;Description : WideString);
begin
	with G2Host1 do
	begin
		OutputDebugString( Error );
		OutputDebugString( Description );
	end
end;

with G2Host1 do
begin
	DataTechnology['Items'] := 'MSXML.DOMDocument';
	DataSource['Items'] := 'C:\Program Files\Exontrol\ExG2Host\Sample\sample.xml';
	DataField[EXG2HOSTLib_TLB.exItemsDataSource] := 'Items';
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		LinesAtRoot := -1;
		SingleSel := False;
		AutoDrag := 3;
	end;
end
3
How can I let user create new items/bars when clicking the empty area of the control
// HostEvent event - Notifies the application once the host fires an event.
procedure TForm1.G2Host1HostEvent(ASender: TObject; EventID : HostEventEnum);
begin
	with G2Host1 do
	begin
		OutputDebugString( HostEventParam[-2] );
	end
end;

with G2Host1 do
begin
	HostReadOnly := Integer(EXG2HOSTLib_TLB.exHostReadWrite) Or Integer(EXG2HOSTLib_TLB.exHostAllowAddEmptyItem);
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		ScrollBars := Integer(EXG2ANTTLib_TLB.exVScrollEmptySpace) Or Integer(EXG2ANTTLib_TLB.exDisableNoVertical);
		with Chart do
		begin
			PaneWidth[False] := 128;
			AllowCreateBar := 1;
		end;
	end;
end
2
How do I handle events of the host

// HostEvent event - Notifies the application once the host fires an event.
procedure TForm1.G2Host1HostEvent(ASender: TObject; EventID : HostEventEnum);
begin
	with G2Host1 do
	begin
		OutputDebugString( HostEventParam[-2] );
	end
end;

with G2Host1 do
begin
	with (IUnknown(Host) as EXG2ANTTLib_TLB.G2antt) do
	begin
		BeginUpdate();
		Columns.Add('new column');
		EndUpdate();
	end;
end
1
How can I get the version of the host/exg2antt control

with G2Host1 do
begin
	OutputDebugString( Version );
	OutputDebugString( 'Host' );
	OutputDebugString( Host.Version );
end