property Chart.ShowCollapsedBars as Boolean
Gets or sets a value that indicates whether the collapsed items displays their child bars.

 TypeDescription 
   Boolean A Boolean expression that specifies whether the child bars are displayed in the parent item if it is collapsed.  
By default, the ShowCollapsedBars property is False. By default, the child bars are not shown in the parent item. Use the ShowCollapsedBars property to display child bars when an item is collapsed. If the ShowCollapsedBars property is True, a collapsed item always displays its child bars. Use the InsertItem method to insert a child items.  Use the AddBar method to add a new bar to the item. Currently, the control includes all child-bars ( recursively ), while previously only the direct-child were included.

The following screen shot shows the bars as the items are not collapsed ( ShowCollapsedBars property is True ) :

Once the Project 1 item gets collapsed we get ( ShowCollapsedBars property is True ) :

or both items collapsed we get ( ShowCollapsedBars property is True ) :

The following VB sample shows the child bars for collapsed items:
With G2antt1
	.BeginUpdate 
	.LinesAtRoot = exLinesAtRoot
	.Columns.Add "Tasks"
	With .Chart
		.FirstVisibleDate = #9/20/2006#
		.ShowCollapsedBars = True
		.LevelCount = 2
		.PaneWidth(0) = 96
	End With
	With .Items
		h = .AddItem("Project 1")
		h1 = .InsertItem(h,0,"Task 1")
		.AddBar h1,"Task",#9/21/2006#,#9/23/2006#,"A"
		h2 = .InsertItem(h,0,"Task 2")
		.AddBar h2,"Task",#9/24/2006#,#9/26/2006#,"B"
		h3 = .InsertItem(h,0,"Task 3")
		.AddBar h3,"Task",#9/27/2006#,#9/29/2006#,"C"
		h = .AddItem("Project 2")
		h1 = .InsertItem(h,0,"Task 1")
		.AddBar h1,"Task",#9/21/2006#,#9/23/2006#,"A"
		h2 = .InsertItem(h,0,"Task 2")
		.AddBar h2,"Task",#9/24/2006#,#9/26/2006#,"B"
		h3 = .InsertItem(h,0,"Task 3")
		.AddBar h3,"Task",#9/27/2006#,#9/29/2006#,"C"
		.ExpandItem(h) = True
	End With
	.EndUpdate 
End With
The following VB.NET sample shows the child bars for collapsed items:
Dim h,h1,h2,h3
With AxG2antt1
	.BeginUpdate 
	.LinesAtRoot = EXG2ANTTLib.LinesAtRootEnum.exLinesAtRoot
	.Columns.Add "Tasks"
	With .Chart
		.FirstVisibleDate = #9/20/2006#
		.ShowCollapsedBars = True
		.LevelCount = 2
		.PaneWidth(0) = 96
	End With
	With .Items
		h = .AddItem("Project 1")
		h1 = .InsertItem(h,0,"Task 1")
		.AddBar h1,"Task",#9/21/2006#,#9/23/2006#,"A"
		h2 = .InsertItem(h,0,"Task 2")
		.AddBar h2,"Task",#9/24/2006#,#9/26/2006#,"B"
		h3 = .InsertItem(h,0,"Task 3")
		.AddBar h3,"Task",#9/27/2006#,#9/29/2006#,"C"
		h = .AddItem("Project 2")
		h1 = .InsertItem(h,0,"Task 1")
		.AddBar h1,"Task",#9/21/2006#,#9/23/2006#,"A"
		h2 = .InsertItem(h,0,"Task 2")
		.AddBar h2,"Task",#9/24/2006#,#9/26/2006#,"B"
		h3 = .InsertItem(h,0,"Task 3")
		.AddBar h3,"Task",#9/27/2006#,#9/29/2006#,"C"
		.ExpandItem(h) = True
	End With
	.EndUpdate 
End With
The following C++ sample shows the child bars for collapsed items:
/*
	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();
spG2antt1->PutLinesAtRoot(EXG2ANTTLib::exLinesAtRoot);
spG2antt1->GetColumns()->Add(L"Tasks");
EXG2ANTTLib::IChartPtr var_Chart = spG2antt1->GetChart();
	var_Chart->PutFirstVisibleDate("9/20/2006");
	var_Chart->PutShowCollapsedBars(VARIANT_TRUE);
	var_Chart->PutLevelCount(2);
	var_Chart->PutPaneWidth(0,96);
EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems();
	long h = var_Items->AddItem("Project 1");
	long h1 = var_Items->InsertItem(h,long(0),"Task 1");
	var_Items->AddBar(h1,"Task","9/21/2006","9/23/2006","A",vtMissing);
	long h2 = var_Items->InsertItem(h,long(0),"Task 2");
	var_Items->AddBar(h2,"Task","9/24/2006","9/26/2006","B",vtMissing);
	long h3 = var_Items->InsertItem(h,long(0),"Task 3");
	var_Items->AddBar(h3,"Task","9/27/2006","9/29/2006","C",vtMissing);
	h = var_Items->AddItem("Project 2");
	h1 = var_Items->InsertItem(h,long(0),"Task 1");
	var_Items->AddBar(h1,"Task","9/21/2006","9/23/2006","A",vtMissing);
	h2 = var_Items->InsertItem(h,long(0),"Task 2");
	var_Items->AddBar(h2,"Task","9/24/2006","9/26/2006","B",vtMissing);
	h3 = var_Items->InsertItem(h,long(0),"Task 3");
	var_Items->AddBar(h3,"Task","9/27/2006","9/29/2006","C",vtMissing);
	var_Items->PutExpandItem(h,VARIANT_TRUE);
spG2antt1->EndUpdate();
The following C# sample shows the child bars for collapsed items:
axG2antt1.BeginUpdate();
axG2antt1.LinesAtRoot = EXG2ANTTLib.LinesAtRootEnum.exLinesAtRoot;
axG2antt1.Columns.Add("Tasks");
EXG2ANTTLib.Chart var_Chart = axG2antt1.Chart;
	var_Chart.FirstVisibleDate = "9/20/2006";
	var_Chart.ShowCollapsedBars = true;
	var_Chart.LevelCount = 2;
	var_Chart.set_PaneWidth(0 != 0,96);
EXG2ANTTLib.Items var_Items = axG2antt1.Items;
	int h = var_Items.AddItem("Project 1");
	int h1 = var_Items.InsertItem(h,0,"Task 1");
	var_Items.AddBar(h1,"Task","9/21/2006","9/23/2006","A",null);
	int h2 = var_Items.InsertItem(h,0,"Task 2");
	var_Items.AddBar(h2,"Task","9/24/2006","9/26/2006","B",null);
	int h3 = var_Items.InsertItem(h,0,"Task 3");
	var_Items.AddBar(h3,"Task","9/27/2006","9/29/2006","C",null);
	h = var_Items.AddItem("Project 2");
	h1 = var_Items.InsertItem(h,0,"Task 1");
	var_Items.AddBar(h1,"Task","9/21/2006","9/23/2006","A",null);
	h2 = var_Items.InsertItem(h,0,"Task 2");
	var_Items.AddBar(h2,"Task","9/24/2006","9/26/2006","B",null);
	h3 = var_Items.InsertItem(h,0,"Task 3");
	var_Items.AddBar(h3,"Task","9/27/2006","9/29/2006","C",null);
	var_Items.set_ExpandItem(h,true);
axG2antt1.EndUpdate();
The following VFP sample shows the child bars for collapsed items:
with thisform.G2antt1
	.BeginUpdate
	.LinesAtRoot = -1
	.Columns.Add("Tasks")
	with .Chart
		.FirstVisibleDate = {^2006-9-20}
		.ShowCollapsedBars = .T.
		.LevelCount = 2
		.PaneWidth(0) = 96
	endwith
	with .Items
		h = .AddItem("Project 1")
		h1 = .InsertItem(h,0,"Task 1")
		.AddBar(h1,"Task",{^2006-9-21},{^2006-9-23},"A")
		h2 = .InsertItem(h,0,"Task 2")
		.AddBar(h2,"Task",{^2006-9-24},{^2006-9-26},"B")
		h3 = .InsertItem(h,0,"Task 3")
		.AddBar(h3,"Task",{^2006-9-27},{^2006-9-29},"C")
		h = .AddItem("Project 2")
		h1 = .InsertItem(h,0,"Task 1")
		.AddBar(h1,"Task",{^2006-9-21},{^2006-9-23},"A")
		h2 = .InsertItem(h,0,"Task 2")
		.AddBar(h2,"Task",{^2006-9-24},{^2006-9-26},"B")
		h3 = .InsertItem(h,0,"Task 3")
		.AddBar(h3,"Task",{^2006-9-27},{^2006-9-29},"C")
		.DefaultItem = h
		.ExpandItem(0) = .T.
	endwith
	.EndUpdate
endwith
The following Delphi sample shows the child bars for collapsed items:
with AxG2antt1 do
begin
	BeginUpdate();
	LinesAtRoot := EXG2ANTTLib.LinesAtRootEnum.exLinesAtRoot;
	Columns.Add('Tasks');
	with Chart do
	begin
		FirstVisibleDate := '9/20/2006';
		ShowCollapsedBars := True;
		LevelCount := 2;
		PaneWidth[0 <> 0] := 96;
	end;
	with Items do
	begin
		h := AddItem('Project 1');
		h1 := InsertItem(h,TObject(0),'Task 1');
		AddBar(h1,'Task','9/21/2006','9/23/2006','A',Nil);
		h2 := InsertItem(h,TObject(0),'Task 2');
		AddBar(h2,'Task','9/24/2006','9/26/2006','B',Nil);
		h3 := InsertItem(h,TObject(0),'Task 3');
		AddBar(h3,'Task','9/27/2006','9/29/2006','C',Nil);
		h := AddItem('Project 2');
		h1 := InsertItem(h,TObject(0),'Task 1');
		AddBar(h1,'Task','9/21/2006','9/23/2006','A',Nil);
		h2 := InsertItem(h,TObject(0),'Task 2');
		AddBar(h2,'Task','9/24/2006','9/26/2006','B',Nil);
		h3 := InsertItem(h,TObject(0),'Task 3');
		AddBar(h3,'Task','9/27/2006','9/29/2006','C',Nil);
		ExpandItem[h] := True;
	end;
	EndUpdate();
end

 

 

 


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