constants ScrollRangeEnum
The ScrollRangeEnum type specifies the positions being accessed by the ScrollRange property. The ScrollRange method specifies that the chart to be scrolled within a range of dates. Use the ItemBar property to access properties of a created bar. The CreateBar event is called once the user creates at runtime a new bar by drag and drop on the chart section. 

The ScrollRangeEnum type supports the following values.

 NameValueDescription 
   exStartDate0 Indicates that the starting date or time of the scrolling range is accessed or requested.  
   exEndDate1 Indicates that the ending date or time of the scrolling range is accessed or requested.  
   exMinDate2 This option is read-only, so setting the exMinDate has no effect. Instead use the exStartDate. Retrieves the minimum date when the chart's scrolling range is specified by Chart.ScrollRange(exStartDate) and Chart.ScrollRange(exEndDate). For instance, you can specify the .Items.ItemBar(Item, "newbar", exBarMinStart) = .Chart.ScrollRange(exMinDate) to limit the starting point of the bar to the scrolling range.  
   exMaxDate3 This option is read-only, so setting the exMaxDate has no effect. Instead use the exEndDate.  Retrieves the maximum date when the chart's scrolling range is specified by Chart.ScrollRange(exStartDate) and Chart.ScrollRange(exEndDate). For instance, you can specify the .Items.ItemBar(Item, "newbar", exBarMaxEnd) = .Chart.ScrollRange(exMaxDate) to limit the ending point of the bar to the scrolling range.  
The following samples shows how can I limit the bars to scrolling range only.

VBA  

' CreateBar event - Fired when the user creates a new bar.
Private Sub G2antt1_CreateBar(ByVal Item As Long,ByVal DateStart As Date,ByVal DateEnd As Date)
	With G2antt1
		With .Items
			.ItemBar(Item,"newbar",22) = G2antt1.Chart.ScrollRange(2)
			.ItemBar(Item,"newbar",25) = G2antt1.Chart.ScrollRange(3)
		End With
	End With
End Sub

With G2antt1
	.BeginUpdate 
	.Columns.Add "Task"
	With .Chart
		.LevelCount = 2
		.PaneWidth(0) = 56
		.ScrollRange(0) = #1/1/2001#
		.ScrollRange(1) = #1/15/2001#
		.FirstVisibleDate = #1/12/2001#
		.AllowCreateBar = 1
	End With
	With .Items
		.AddItem "Task 1"
		.AddItem "Task 2"
		.AddItem "Task 3"
	End With
	.EndUpdate 
End With
VB6  
' CreateBar event - Fired when the user creates a new bar.
Private Sub G2antt1_CreateBar(ByVal Item As EXG2ANTTLibCtl.HITEM,ByVal DateStart As Date,ByVal DateEnd As Date)
	With G2antt1
		With .Items
			.ItemBar(Item,"newbar",exBarMinStart) = G2antt1.Chart.ScrollRange(exMinDate)
			.ItemBar(Item,"newbar",exBarMaxEnd) = G2antt1.Chart.ScrollRange(exMaxDate)
		End With
	End With
End Sub

With G2antt1
	.BeginUpdate 
	.Columns.Add "Task"
	With .Chart
		.LevelCount = 2
		.PaneWidth(0) = 56
		.ScrollRange(exStartDate) = #1/1/2001#
		.ScrollRange(exEndDate) = #1/15/2001#
		.FirstVisibleDate = #1/12/2001#
		.AllowCreateBar = exCreateBarAuto
	End With
	With .Items
		.AddItem "Task 1"
		.AddItem "Task 2"
		.AddItem "Task 3"
	End With
	.EndUpdate 
End With
VB.NET  
' CreateBar event - Fired when the user creates a new bar.
Private Sub Exg2antt1_CreateBar(ByVal sender As System.Object,ByVal Item As Integer,ByVal DateStart As Date,ByVal DateEnd As Date) Handles Exg2antt1.CreateBar
	With Exg2antt1
		With .Items
			.set_ItemBar(Item,"newbar",exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarMinStart,Exg2antt1.Chart.get_ScrollRange(exontrol.EXG2ANTTLib.ScrollRangeEnum.exMinDate))
			.set_ItemBar(Item,"newbar",exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarMaxEnd,Exg2antt1.Chart.get_ScrollRange(exontrol.EXG2ANTTLib.ScrollRangeEnum.exMaxDate))
		End With
	End With
End Sub

With Exg2antt1
	.BeginUpdate()
	.Columns.Add("Task")
	With .Chart
		.LevelCount = 2
		.set_PaneWidth(False,56)
		.set_ScrollRange(exontrol.EXG2ANTTLib.ScrollRangeEnum.exStartDate,#1/1/2001#)
		.set_ScrollRange(exontrol.EXG2ANTTLib.ScrollRangeEnum.exEndDate,#1/15/2001#)
		.FirstVisibleDate = #1/12/2001#
		.AllowCreateBar = exontrol.EXG2ANTTLib.CreateBarEnum.exCreateBarAuto
	End With
	With .Items
		.AddItem("Task 1")
		.AddItem("Task 2")
		.AddItem("Task 3")
	End With
	.EndUpdate()
End With
VB.NET for /COM  
' CreateBar event - Fired when the user creates a new bar.
Private Sub AxG2antt1_CreateBar(ByVal sender As System.Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_CreateBarEvent) Handles AxG2antt1.CreateBar
	With AxG2antt1
		With .Items
			.ItemBar(e.item,"newbar",EXG2ANTTLib.ItemBarPropertyEnum.exBarMinStart) = AxG2antt1.Chart.ScrollRange(EXG2ANTTLib.ScrollRangeEnum.exMinDate)
			.ItemBar(e.item,"newbar",EXG2ANTTLib.ItemBarPropertyEnum.exBarMaxEnd) = AxG2antt1.Chart.ScrollRange(EXG2ANTTLib.ScrollRangeEnum.exMaxDate)
		End With
	End With
End Sub

With AxG2antt1
	.BeginUpdate()
	.Columns.Add("Task")
	With .Chart
		.LevelCount = 2
		.PaneWidth(False) = 56
		.ScrollRange(EXG2ANTTLib.ScrollRangeEnum.exStartDate) = #1/1/2001#
		.ScrollRange(EXG2ANTTLib.ScrollRangeEnum.exEndDate) = #1/15/2001#
		.FirstVisibleDate = #1/12/2001#
		.AllowCreateBar = EXG2ANTTLib.CreateBarEnum.exCreateBarAuto
	End With
	With .Items
		.AddItem("Task 1")
		.AddItem("Task 2")
		.AddItem("Task 3")
	End With
	.EndUpdate()
End With
C++  
// CreateBar event - Fired when the user creates a new bar.
void OnCreateBarG2antt1(long Item,DATE DateStart,DATE DateEnd)
{
	/*
		Copy and paste the following directives to your header file as
		it defines the namespace 'EXG2ANTTLib' for the library: 'ExG2antt 1.0 Control Library'
		#import <ExG2antt.dll>
		using namespace EXG2ANTTLib
	*/
	EXG2ANTTLib::IG2anttPtr spG2antt1 = GetDlgItem(IDC_G2ANTT1)->GetControlUnknown()
	EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems()
		var_Items->PutItemBar(Item,"newbar",EXG2ANTTLib::exBarMinStart,spG2antt1->GetChart()->GetScrollRange(EXG2ANTTLib::exMinDate))
		var_Items->PutItemBar(Item,"newbar",EXG2ANTTLib::exBarMaxEnd,spG2antt1->GetChart()->GetScrollRange(EXG2ANTTLib::exMaxDate))
}

EXG2ANTTLib::IG2anttPtr spG2antt1 = GetDlgItem(IDC_G2ANTT1)->GetControlUnknown();
spG2antt1->BeginUpdate();
spG2antt1->GetColumns()->Add(L"Task");
EXG2ANTTLib::IChartPtr var_Chart = spG2antt1->GetChart();
	var_Chart->PutLevelCount(2);
	var_Chart->PutPaneWidth(VARIANT_FALSE,56);
	var_Chart->PutScrollRange(EXG2ANTTLib::exStartDate,"1/1/2001");
	var_Chart->PutScrollRange(EXG2ANTTLib::exEndDate,"1/15/2001");
	var_Chart->PutFirstVisibleDate("1/12/2001");
	var_Chart->PutAllowCreateBar(EXG2ANTTLib::exCreateBarAuto);
EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems();
	var_Items->AddItem("Task 1");
	var_Items->AddItem("Task 2");
	var_Items->AddItem("Task 3");
spG2antt1->EndUpdate();
C++ Builder  
// CreateBar event - Fired when the user creates a new bar.
void __fastcall TForm1::G2antt1CreateBar(TObject *Sender,Exg2anttlib_tlb::HITEM Item,DATE DateStart,DATE DateEnd)
{
	Exg2anttlib_tlb::IItemsPtr var_Items = G2antt1->Items
		var_Items->set_ItemBar(Item,TVariant("newbar"),Exg2anttlib_tlb::ItemBarPropertyEnum::exBarMinStart,TVariant(G2antt1->Chart->get_ScrollRange(Exg2anttlib_tlb::ScrollRangeEnum::exMinDate)))
		var_Items->set_ItemBar(Item,TVariant("newbar"),Exg2anttlib_tlb::ItemBarPropertyEnum::exBarMaxEnd,TVariant(G2antt1->Chart->get_ScrollRange(Exg2anttlib_tlb::ScrollRangeEnum::exMaxDate)))
}

G2antt1->BeginUpdate();
G2antt1->Columns->Add(L"Task");
Exg2anttlib_tlb::IChartPtr var_Chart = G2antt1->Chart;
	var_Chart->LevelCount = 2;
	var_Chart->set_PaneWidth(false,56);
	var_Chart->set_ScrollRange(Exg2anttlib_tlb::ScrollRangeEnum::exStartDate,TVariant(TDateTime(2001,1,1).operator double()));
	var_Chart->set_ScrollRange(Exg2anttlib_tlb::ScrollRangeEnum::exEndDate,TVariant(TDateTime(2001,1,15).operator double()));
	var_Chart->set_FirstVisibleDate(TVariant(TDateTime(2001,1,12).operator double()));
	var_Chart->AllowCreateBar = Exg2anttlib_tlb::CreateBarEnum::exCreateBarAuto;
Exg2anttlib_tlb::IItemsPtr var_Items = G2antt1->Items;
	var_Items->AddItem(TVariant("Task 1"));
	var_Items->AddItem(TVariant("Task 2"));
	var_Items->AddItem(TVariant("Task 3"));
G2antt1->EndUpdate();
C#  
// CreateBar event - Fired when the user creates a new bar.
private void exg2antt1_CreateBar(object sender,int Item,DateTime DateStart,DateTime DateEnd)
{
	exontrol.EXG2ANTTLib.Items var_Items = exg2antt1.Items
		var_Items.set_ItemBar(Item,"newbar",exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarMinStart,exg2antt1.Chart.get_ScrollRange(exontrol.EXG2ANTTLib.ScrollRangeEnum.exMinDate))
		var_Items.set_ItemBar(Item,"newbar",exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarMaxEnd,exg2antt1.Chart.get_ScrollRange(exontrol.EXG2ANTTLib.ScrollRangeEnum.exMaxDate))
}
//this.exg2antt1.CreateBar += new exontrol.EXG2ANTTLib.exg2antt.CreateBarEventHandler(this.exg2antt1_CreateBar);

exg2antt1.BeginUpdate();
exg2antt1.Columns.Add("Task");
exontrol.EXG2ANTTLib.Chart var_Chart = exg2antt1.Chart;
	var_Chart.LevelCount = 2;
	var_Chart.set_PaneWidth(false,56);
	var_Chart.set_ScrollRange(exontrol.EXG2ANTTLib.ScrollRangeEnum.exStartDate,Convert.ToDateTime("1/1/2001"));
	var_Chart.set_ScrollRange(exontrol.EXG2ANTTLib.ScrollRangeEnum.exEndDate,Convert.ToDateTime("1/15/2001"));
	var_Chart.FirstVisibleDate = Convert.ToDateTime("1/12/2001");
	var_Chart.AllowCreateBar = exontrol.EXG2ANTTLib.CreateBarEnum.exCreateBarAuto;
exontrol.EXG2ANTTLib.Items var_Items = exg2antt1.Items;
	var_Items.AddItem("Task 1");
	var_Items.AddItem("Task 2");
	var_Items.AddItem("Task 3");
exg2antt1.EndUpdate();
JavaScript  
<SCRIPT FOR="G2antt1" EVENT="CreateBar(Item,DateStart,DateEnd)" LANGUAGE="JScript">
	var var_Items = G2antt1.Items
		var_Items.ItemBar(Item,"newbar",22) = G2antt1.Chart.ScrollRange(2)
		var_Items.ItemBar(Item,"newbar",25) = G2antt1.Chart.ScrollRange(3)
</SCRIPT>

<OBJECT classid="clsid:CD481F4D-2D25-4759-803F-752C568F53B7" id="G2antt1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
	G2antt1.BeginUpdate()

	G2antt1.Columns.Add("Task")

	var var_Chart = G2antt1.Chart

		var_Chart.LevelCount = 2

		var_Chart.PaneWidth(0) = 56

		var_Chart.ScrollRange(0) = "1/1/2001"

		var_Chart.ScrollRange(1) = "1/15/2001"

		var_Chart.FirstVisibleDate = "1/12/2001"

		var_Chart.AllowCreateBar = 1

	var var_Items = G2antt1.Items

		var_Items.AddItem("Task 1")

		var_Items.AddItem("Task 2")

		var_Items.AddItem("Task 3")

	G2antt1.EndUpdate()

</SCRIPT>
C# for /COM  
// CreateBar event - Fired when the user creates a new bar.
private void axG2antt1_CreateBar(object sender, AxEXG2ANTTLib._IG2anttEvents_CreateBarEvent e)
{
	EXG2ANTTLib.Items var_Items = axG2antt1.Items
		var_Items.set_ItemBar(e.item,"newbar",EXG2ANTTLib.ItemBarPropertyEnum.exBarMinStart,axG2antt1.Chart.get_ScrollRange(EXG2ANTTLib.ScrollRangeEnum.exMinDate))
		var_Items.set_ItemBar(e.item,"newbar",EXG2ANTTLib.ItemBarPropertyEnum.exBarMaxEnd,axG2antt1.Chart.get_ScrollRange(EXG2ANTTLib.ScrollRangeEnum.exMaxDate))
}
//this.axG2antt1.CreateBar += new AxEXG2ANTTLib._IG2anttEvents_CreateBarEventHandler(this.axG2antt1_CreateBar);

axG2antt1.BeginUpdate();
axG2antt1.Columns.Add("Task");
EXG2ANTTLib.Chart var_Chart = axG2antt1.Chart;
	var_Chart.LevelCount = 2;
	var_Chart.set_PaneWidth(false,56);
	var_Chart.set_ScrollRange(EXG2ANTTLib.ScrollRangeEnum.exStartDate,Convert.ToDateTime("1/1/2001"));
	var_Chart.set_ScrollRange(EXG2ANTTLib.ScrollRangeEnum.exEndDate,Convert.ToDateTime("1/15/2001"));
	var_Chart.FirstVisibleDate = Convert.ToDateTime("1/12/2001");
	var_Chart.AllowCreateBar = EXG2ANTTLib.CreateBarEnum.exCreateBarAuto;
EXG2ANTTLib.Items var_Items = axG2antt1.Items;
	var_Items.AddItem("Task 1");
	var_Items.AddItem("Task 2");
	var_Items.AddItem("Task 3");
axG2antt1.EndUpdate();
X++ (Dynamics Ax 2009)  
// CreateBar event - Fired when the user creates a new bar.
void onEvent_CreateBar(int _Item,date _DateStart,date _DateEnd)
{
	COM com_Items
	anytype var_Items
	var_Items = exg2antt1.Items()
	 com_Items = var_Items
		com_Items.ItemBar(_Item,"newbar",22/*exBarMinStart*/,exg2antt1.Chart().ScrollRange(2/*exMinDate*/))
		com_Items.ItemBar(_Item,"newbar",25/*exBarMaxEnd*/,exg2antt1.Chart().ScrollRange(3/*exMaxDate*/))
}

public void init()
{
	COM com_Chart,com_Items

	anytype var_Chart,var_Items




	super()


	exg2antt1.BeginUpdate()

	exg2antt1.Columns().Add("Task")

	var_Chart = exg2antt1.Chart()
	 com_Chart = var_Chart

		com_Chart.LevelCount(2)

	/*should be called during the form's activate method*/ 	com_Chart.PaneWidth(0,56);
		com_Chart.ScrollRange(0/*exStartDate*/,COMVariant::createFromDate(str2Date("1/1/2001",213)))

		com_Chart.ScrollRange(1/*exEndDate*/,COMVariant::createFromDate(str2Date("1/15/2001",213)))

		com_Chart.FirstVisibleDate(COMVariant::createFromDate(str2Date("1/12/2001",213)))

		com_Chart.AllowCreateBar(1/*exCreateBarAuto*/)

	var_Items = exg2antt1.Items()
	 com_Items = var_Items

		com_Items.AddItem("Task 1")

		com_Items.AddItem("Task 2")

		com_Items.AddItem("Task 3")

	exg2antt1.EndUpdate()

}

/*
public void activate(boolean _active)
{
	super(_active)


	exg2antt1.Chart().PaneWidth(0,56)

}
*/
VFP  
*** CreateBar event - Fired when the user creates a new bar. ***
LPARAMETERS Item,DateStart,DateEnd
	with thisform.G2antt1
		with .Items
			.ItemBar(Item,"newbar",22) = thisform.G2antt1.Chart.ScrollRange(2)
			.ItemBar(Item,"newbar",25) = thisform.G2antt1.Chart.ScrollRange(3)
		endwith
	endwith

with thisform.G2antt1
	.BeginUpdate
	.Columns.Add("Task")
	with .Chart
		.LevelCount = 2
		.PaneWidth(0) = 56
		.ScrollRange(0) = {^2001-1-1}
		.ScrollRange(1) = {^2001-1-15}
		.FirstVisibleDate = {^2001-1-12}
		.AllowCreateBar = 1
	endwith
	with .Items
		.AddItem("Task 1")
		.AddItem("Task 2")
		.AddItem("Task 3")
	endwith
	.EndUpdate
endwith
dBASE Plus  
/*
with (this.ACTIVEX1.nativeObject)
	CreateBar = class::nativeObject_CreateBar
endwith
*/
// Fired when the user creates a new bar.
function nativeObject_CreateBar(Item,DateStart,DateEnd)
	local oG2antt,var_Items
	oG2antt = form.Activex1.nativeObject
	var_Items = oG2antt.Items
		// var_Items.ItemBar(Item,"newbar",22) = oG2antt.Chart.ScrollRange(2)
		with (oG2antt)
			TemplateDef = [Dim var_Items,Item]
			TemplateDef = var_Items
			TemplateDef = Item
			Template = [var_Items.ItemBar(Item,"newbar",22) = oG2antt.Chart.ScrollRange(2)]
		endwith
		// var_Items.ItemBar(Item,"newbar",25) = oG2antt.Chart.ScrollRange(3)
		with (oG2antt)
			TemplateDef = [Dim var_Items,Item]
			TemplateDef = var_Items
			TemplateDef = Item
			Template = [var_Items.ItemBar(Item,"newbar",25) = oG2antt.Chart.ScrollRange(3)]
		endwith
return

local oG2antt,var_Chart,var_Items

oG2antt = form.Activex1.nativeObject
oG2antt.BeginUpdate()
oG2antt.Columns.Add("Task")
var_Chart = oG2antt.Chart
	var_Chart.LevelCount = 2
	// var_Chart.PaneWidth(false) = 56
	with (oG2antt)
		TemplateDef = [Dim var_Chart]
		TemplateDef = var_Chart
		Template = [var_Chart.PaneWidth(false) = 56]
	endwith
	// var_Chart.ScrollRange(0) = "01/01/2001"
	with (oG2antt)
		TemplateDef = [Dim var_Chart]
		TemplateDef = var_Chart
		Template = [var_Chart.ScrollRange(0) = "01/01/2001"]
	endwith
	// var_Chart.ScrollRange(1) = "01/15/2001"
	with (oG2antt)
		TemplateDef = [Dim var_Chart]
		TemplateDef = var_Chart
		Template = [var_Chart.ScrollRange(1) = "01/15/2001"]
	endwith
	var_Chart.FirstVisibleDate = "01/12/2001"
	var_Chart.AllowCreateBar = 1
var_Items = oG2antt.Items
	var_Items.AddItem("Task 1")
	var_Items.AddItem("Task 2")
	var_Items.AddItem("Task 3")
oG2antt.EndUpdate()
XBasic (Alpha Five)  
' Fired when the user creates a new bar.
function CreateBar as v (Item as OLE::Exontrol.G2antt.1::HITEM,DateStart as T,DateEnd as T)
	Dim oG2antt as P
	Dim var_Items as P
	oG2antt = topparent:CONTROL_ACTIVEX1.activex
	var_Items = oG2antt.Items
		' var_Items.ItemBar(Item,"newbar",22) = oG2antt.Chart.ScrollRange(2)
		oG2antt.TemplateDef = "Dim var_Items,Item"
		oG2antt.TemplateDef = var_Items
		oG2antt.TemplateDef = Item
		oG2antt.Template = "var_Items.ItemBar(Item,\"newbar\",22) = oG2antt.Chart.ScrollRange(2)"
		' var_Items.ItemBar(Item,"newbar",25) = oG2antt.Chart.ScrollRange(3)
		oG2antt.TemplateDef = "Dim var_Items,Item"
		oG2antt.TemplateDef = var_Items
		oG2antt.TemplateDef = Item
		oG2antt.Template = "var_Items.ItemBar(Item,\"newbar\",25) = oG2antt.Chart.ScrollRange(3)"
end function

Dim oG2antt as P
Dim var_Chart as P
Dim var_Items as P

oG2antt = topparent:CONTROL_ACTIVEX1.activex
oG2antt.BeginUpdate()
oG2antt.Columns.Add("Task")
var_Chart = oG2antt.Chart
	var_Chart.LevelCount = 2
	' var_Chart.PaneWidth(.f.) = 56
	oG2antt.TemplateDef = "Dim var_Chart"
	oG2antt.TemplateDef = var_Chart
	oG2antt.Template = "var_Chart.PaneWidth(False) = 56"

	' var_Chart.ScrollRange(0) = {01/01/2001}
	oG2antt.TemplateDef = "Dim var_Chart"
	oG2antt.TemplateDef = var_Chart
	oG2antt.Template = "var_Chart.ScrollRange(0) = #01/01/2001#"

	' var_Chart.ScrollRange(1) = {01/15/2001}
	oG2antt.TemplateDef = "Dim var_Chart"
	oG2antt.TemplateDef = var_Chart
	oG2antt.Template = "var_Chart.ScrollRange(1) = #01/15/2001#"

	var_Chart.FirstVisibleDate = {01/12/2001}
	var_Chart.AllowCreateBar = 1
var_Items = oG2antt.Items
	var_Items.AddItem("Task 1")
	var_Items.AddItem("Task 2")
	var_Items.AddItem("Task 3")
oG2antt.EndUpdate()
Delphi 8 (.NET only)  
// CreateBar event - Fired when the user creates a new bar.
procedure TWinForm1.AxG2antt1_CreateBar(sender: System.Object; e: AxEXG2ANTTLib._IG2anttEvents_CreateBarEvent);
begin
	with AxG2antt1 do
	begin
		with Items do
		begin
			ItemBar[e.item,'newbar',EXG2ANTTLib.ItemBarPropertyEnum.exBarMinStart] := AxG2antt1.Chart.ScrollRange[EXG2ANTTLib.ScrollRangeEnum.exMinDate];
			ItemBar[e.item,'newbar',EXG2ANTTLib.ItemBarPropertyEnum.exBarMaxEnd] := AxG2antt1.Chart.ScrollRange[EXG2ANTTLib.ScrollRangeEnum.exMaxDate];
		end
	end
end;

with AxG2antt1 do
begin
	BeginUpdate();
	Columns.Add('Task');
	with Chart do
	begin
		LevelCount := 2;
		PaneWidth[False] := 56;
		ScrollRange[EXG2ANTTLib.ScrollRangeEnum.exStartDate] := '1/1/2001';
		ScrollRange[EXG2ANTTLib.ScrollRangeEnum.exEndDate] := '1/15/2001';
		FirstVisibleDate := '1/12/2001';
		AllowCreateBar := EXG2ANTTLib.CreateBarEnum.exCreateBarAuto;
	end;
	with Items do
	begin
		AddItem('Task 1');
		AddItem('Task 2');
		AddItem('Task 3');
	end;
	EndUpdate();
end
Delphi (standard)  
// CreateBar event - Fired when the user creates a new bar.
procedure TForm1.G2antt1CreateBar(ASender: TObject; Item : HITEM;DateStart : TDateTime;DateEnd : TDateTime);
begin
	with G2antt1 do
	begin
		with Items do
		begin
			ItemBar[Item,'newbar',EXG2ANTTLib_TLB.exBarMinStart] := G2antt1.Chart.ScrollRange[EXG2ANTTLib_TLB.exMinDate];
			ItemBar[Item,'newbar',EXG2ANTTLib_TLB.exBarMaxEnd] := G2antt1.Chart.ScrollRange[EXG2ANTTLib_TLB.exMaxDate];
		end
	end
end;

with G2antt1 do
begin
	BeginUpdate();
	Columns.Add('Task');
	with Chart do
	begin
		LevelCount := 2;
		PaneWidth[False] := 56;
		ScrollRange[EXG2ANTTLib_TLB.exStartDate] := '1/1/2001';
		ScrollRange[EXG2ANTTLib_TLB.exEndDate] := '1/15/2001';
		FirstVisibleDate := '1/12/2001';
		AllowCreateBar := EXG2ANTTLib_TLB.exCreateBarAuto;
	end;
	with Items do
	begin
		AddItem('Task 1');
		AddItem('Task 2');
		AddItem('Task 3');
	end;
	EndUpdate();
end
Visual Objects  
METHOD OCX_Exontrol1CreateBar(Item,DateStart,DateEnd) CLASS MainDialog
	// CreateBar event - Fired when the user creates a new bar.
	local var_Items as IItems
	var_Items := oDCOCX_Exontrol1:Items
		var_Items:[ItemBar,Item,"newbar",exBarMinStart] := oDCOCX_Exontrol1:Chart:[ScrollRange,exMinDate]
		var_Items:[ItemBar,Item,"newbar",exBarMaxEnd] := oDCOCX_Exontrol1:Chart:[ScrollRange,exMaxDate]
RETURN NIL

local var_Chart as IChart
local var_Items as IItems

oDCOCX_Exontrol1:BeginUpdate()
oDCOCX_Exontrol1:Columns:Add("Task")
var_Chart := oDCOCX_Exontrol1:Chart
	var_Chart:LevelCount := 2
	var_Chart:[PaneWidth,false] := 56
	var_Chart:[ScrollRange,exStartDate] := SToD("20010101")
	var_Chart:[ScrollRange,exEndDate] := SToD("20010115")
	var_Chart:FirstVisibleDate := SToD("20010112")
	var_Chart:AllowCreateBar := exCreateBarAuto
var_Items := oDCOCX_Exontrol1:Items
	var_Items:AddItem("Task 1")
	var_Items:AddItem("Task 2")
	var_Items:AddItem("Task 3")
oDCOCX_Exontrol1:EndUpdate()
PowerBuilder
/*begin event CreateBar(long Item,datetime DateStart,datetime DateEnd) - Fired when the user creates a new bar.*/
/*
	OleObject oG2antt,var_Items
	oG2antt = ole_1.Object
	var_Items = oG2antt.Items
		var_Items.ItemBar(Item,"newbar",22,oG2antt.Chart.ScrollRange(2))
		var_Items.ItemBar(Item,"newbar",25,oG2antt.Chart.ScrollRange(3))
*/
/*end event CreateBar*/

OleObject oG2antt,var_Chart,var_Items

oG2antt = ole_1.Object
oG2antt.BeginUpdate()
oG2antt.Columns.Add("Task")
var_Chart = oG2antt.Chart
	var_Chart.LevelCount = 2
	var_Chart.PaneWidth(false,56)
	var_Chart.ScrollRange(0,2001-01-01)
	var_Chart.ScrollRange(1,2001-01-15)
	var_Chart.FirstVisibleDate = 2001-01-12
	var_Chart.AllowCreateBar = 1
var_Items = oG2antt.Items
	var_Items.AddItem("Task 1")
	var_Items.AddItem("Task 2")
	var_Items.AddItem("Task 3")
oG2antt.EndUpdate()
 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.