property Items.AllowCellValueToItemBar as Boolean
Retrieves or sets a value that indicates whether the cells display associated properties of the bars in the item.

 TypeDescription 
   Boolean A Boolean expression that specifies whether the control handles properties of the bars in the column's section.  
By default, the AllowCellValueToItemBar property is False. In other words, if there is any association between a cell and a property bar they do not have any effect, while the AllowCellValueToItemBar property is False. The AllowCellValueToItemBar property allows the cells to display properties of the bars, and the property of the bar to be specified by the cell's value. For instance, you can use the CellValueToItemBar feature to display the start and ending date of any bar in the item, for the entire column, or in any cell. The values in the cells are automatically changed once the bar is resized or moved and reverse, if the cell's value is changed the associated bar is moved or resized.

The following screen shot shows the association between ItemBar(exBarEffort) property of the bar with the cell in last column, so changing it is automatically reflected in the chart's histogram :

The cell's value can be associated with any property of the bar, using the:

Once an association between a cell and a bar is made, the CellValue property and ItemBar property returns the same result, or in other words, changing the cell's value will be reflected in the bar's property, and back, so changing the bar's property will change the cell's value.

The following VB sample display automatically the start and end dates of the bars in the Start and End columns:

With G2antt1
	.BeginUpdate 
	With .Columns
		.Add "Tasks"
		With .Add("Start")
			.Def(exCellValueToItemBarProperty) = 1
			.Editor.EditType = DateType
		End With
		With .Add("End")
			.Def(exCellValueToItemBarProperty) = 2
			.Editor.EditType = DateType
		End With
	End With
	With .Chart
		.FirstVisibleDate = #9/20/2006#
		.AllowLinkBars = True
		.AllowCreateBar = exNoCreateBar
		.LevelCount = 2
		.PaneWidth(0) = 196
	End With
	With .Items
		.AllowCellValueToItemBar = True
		.AddBar .AddItem("Task 1"),"Task",#9/21/2006#,#9/24/2006#
		.AddBar .AddItem("Task 2"),"Task",#9/22/2006#,#9/25/2006#
		.AddBar .AddItem("Task 3"),"Task",#9/23/2006#,#9/26/2006#
	End With
	.EndUpdate 
End With
The following VB.NET sample display automatically the start and end dates of the bars in the Start and End columns:
With AxG2antt1
	.BeginUpdate 
	With .Columns
		.Add "Tasks"
		With .Add("Start")
			.Def(EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty) = 1
			.Editor.EditType = EXG2ANTTLib.EditTypeEnum.DateType
		End With
		With .Add("End")
			.Def(EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty) = 2
			.Editor.EditType = EXG2ANTTLib.EditTypeEnum.DateType
		End With
	End With
	With .Chart
		.FirstVisibleDate = #9/20/2006#
		.AllowLinkBars = True
		.AllowCreateBar = EXG2ANTTLib.CreateBarEnum.exNoCreateBar
		.LevelCount = 2
		.PaneWidth(0) = 196
	End With
	With .Items
		.AllowCellValueToItemBar = True
		.AddBar .AddItem("Task 1"),"Task",#9/21/2006#,#9/24/2006#
		.AddBar .AddItem("Task 2"),"Task",#9/22/2006#,#9/25/2006#
		.AddBar .AddItem("Task 3"),"Task",#9/23/2006#,#9/26/2006#
	End With
	.EndUpdate 
End With
The following C++ sample display automatically the start and end dates of the bars in the Start and End columns:
/*
	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();
spG2antt1->BeginUpdate();
EXG2ANTTLib::IColumnsPtr var_Columns = spG2antt1->GetColumns();
	var_Columns->Add(L"Tasks");
	EXG2ANTTLib::IColumnPtr var_Column = ((EXG2ANTTLib::IColumnPtr)(var_Columns->Add(L"Start")));
		var_Column->PutDef(EXG2ANTTLib::exCellValueToItemBarProperty,long(1));
		var_Column->GetEditor()->PutEditType(EXG2ANTTLib::DateType);
	EXG2ANTTLib::IColumnPtr var_Column1 = ((EXG2ANTTLib::IColumnPtr)(var_Columns->Add(L"End")));
		var_Column1->PutDef(EXG2ANTTLib::exCellValueToItemBarProperty,long(2));
		var_Column1->GetEditor()->PutEditType(EXG2ANTTLib::DateType);
EXG2ANTTLib::IChartPtr var_Chart = spG2antt1->GetChart();
	var_Chart->PutFirstVisibleDate("9/20/2006");
	var_Chart->PutAllowLinkBars(VARIANT_TRUE);
	var_Chart->PutAllowCreateBar(EXG2ANTTLib::exNoCreateBar);
	var_Chart->PutLevelCount(2);
	var_Chart->PutPaneWidth(0,196);
EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems();
	var_Items->PutAllowCellValueToItemBar(VARIANT_TRUE);
	var_Items->AddBar(var_Items->AddItem("Task 1"),"Task","9/21/2006","9/24/2006",vtMissing,vtMissing);
	var_Items->AddBar(var_Items->AddItem("Task 2"),"Task","9/22/2006","9/25/2006",vtMissing,vtMissing);
	var_Items->AddBar(var_Items->AddItem("Task 3"),"Task","9/23/2006","9/26/2006",vtMissing,vtMissing);
spG2antt1->EndUpdate();
The following C# sample display automatically the start and end dates of the bars in the Start and End columns:
axG2antt1.BeginUpdate();
EXG2ANTTLib.Columns var_Columns = axG2antt1.Columns;
	var_Columns.Add("Tasks");
	EXG2ANTTLib.Column var_Column = (var_Columns.Add("Start") as EXG2ANTTLib.Column);
		var_Column.set_Def(EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,1);
		var_Column.Editor.EditType = EXG2ANTTLib.EditTypeEnum.DateType;
	EXG2ANTTLib.Column var_Column1 = (var_Columns.Add("End") as EXG2ANTTLib.Column);
		var_Column1.set_Def(EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,2);
		var_Column1.Editor.EditType = EXG2ANTTLib.EditTypeEnum.DateType;
EXG2ANTTLib.Chart var_Chart = axG2antt1.Chart;
	var_Chart.FirstVisibleDate = "9/20/2006";
	var_Chart.AllowLinkBars = true;
	var_Chart.AllowCreateBar = EXG2ANTTLib.CreateBarEnum.exNoCreateBar;
	var_Chart.LevelCount = 2;
	var_Chart.set_PaneWidth(0 != 0,196);
EXG2ANTTLib.Items var_Items = axG2antt1.Items;
	var_Items.AllowCellValueToItemBar = true;
	var_Items.AddBar(var_Items.AddItem("Task 1"),"Task","9/21/2006","9/24/2006",null,null);
	var_Items.AddBar(var_Items.AddItem("Task 2"),"Task","9/22/2006","9/25/2006",null,null);
	var_Items.AddBar(var_Items.AddItem("Task 3"),"Task","9/23/2006","9/26/2006",null,null);
axG2antt1.EndUpdate();
The following VFP sample display automatically the start and end dates of the bars in the Start and End columns:
with thisform.G2antt1
	.BeginUpdate
	with .Columns
		.Add("Tasks")
		with .Add("Start")
			.Def(18) = 1
			.Editor.EditType = 7
		endwith
		with .Add("End")
			.Def(18) = 2
			.Editor.EditType = 7
		endwith
	endwith
	with .Chart
		.FirstVisibleDate = {^2006-9-20}
		.AllowLinkBars = .T.
		.AllowCreateBar = 0
		.LevelCount = 2
		.PaneWidth(0) = 196
	endwith
	with .Items
		.AllowCellValueToItemBar = .T.
		.AddBar(.AddItem("Task 1"),"Task",{^2006-9-21},{^2006-9-24})
		.AddBar(.AddItem("Task 2"),"Task",{^2006-9-22},{^2006-9-25})
		.AddBar(.AddItem("Task 3"),"Task",{^2006-9-23},{^2006-9-26})
	endwith
	.EndUpdate
endwith
The following Delphi sample display automatically the start and end dates of the bars in the Start and End columns:
with AxG2antt1 do
begin
	BeginUpdate();
	with Columns do
	begin
		Add('Tasks');
		with (Add('Start') as EXG2ANTTLib.Column) do
		begin
			Def[EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty] := TObject(1);
			Editor.EditType := EXG2ANTTLib.EditTypeEnum.DateType;
		end;
		with (Add('End') as EXG2ANTTLib.Column) do
		begin
			Def[EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty] := TObject(2);
			Editor.EditType := EXG2ANTTLib.EditTypeEnum.DateType;
		end;
	end;
	with Chart do
	begin
		FirstVisibleDate := '9/20/2006';
		AllowLinkBars := True;
		AllowCreateBar := EXG2ANTTLib.CreateBarEnum.exNoCreateBar;
		LevelCount := 2;
		PaneWidth[0 <> 0] := 196;
	end;
	with Items do
	begin
		AllowCellValueToItemBar := True;
		AddBar(AddItem('Task 1'),'Task','9/21/2006','9/24/2006',Nil,Nil);
		AddBar(AddItem('Task 2'),'Task','9/22/2006','9/25/2006',Nil,Nil);
		AddBar(AddItem('Task 3'),'Task','9/23/2006','9/26/2006',Nil,Nil);
	end;
	EndUpdate();
end

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