Type | Description | |||
String | A String expression that indicates the list of bars that the current format is applied to. |
The following screen shot shows different colors applied to different items, using the ConditionalFormat feature:
The following samples show how you can change the bar's color based on its length/duration:
VBA (MS Access, Excell...)
With G2antt1 .BeginUpdate With .Columns .Add "Tasks" With .Add("Duration") .Def(18) = 513 .Editor.EditType = 4 End With End With .Items.AllowCellValueToItemBar = True With .Chart .FirstWeekDay = 1 .LevelCount = 2 .FirstVisibleDate = #6/6/2005# .PaneWidth(False) = 128 End With With .ConditionalFormats.Add("%1 >= 4") .ApplyTo = 1 ' &H1 .Bold = True .ApplyToBars = "Task" .BarColor = RGB(255,0,0) .ForeColor = .BarColor End With With .Items .AddBar .AddItem("Task"),"Task",#6/10/2005#,#6/13/2005#,"" .AddBar .AddItem("Task"),"Task",#6/11/2005#,#6/16/2005#,"" .AddBar .AddItem("Task"),"Task",#6/12/2005#,#6/15/2005#,"" End With .EndUpdate End With
VB6
With G2antt1 .BeginUpdate With .Columns .Add "Tasks" With .Add("Duration") .Def(exCellValueToItemBarProperty) = 513 .Editor.EditType = SpinType End With End With .Items.AllowCellValueToItemBar = True With .Chart .FirstWeekDay = exMonday .LevelCount = 2 .FirstVisibleDate = #6/6/2005# .PaneWidth(False) = 128 End With With .ConditionalFormats.Add("%1 >= 4") .ApplyTo = &H1 .Bold = True .ApplyToBars = "Task" .BarColor = RGB(255,0,0) .ForeColor = .BarColor End With With .Items .AddBar .AddItem("Task"),"Task",#6/10/2005#,#6/13/2005#,"" .AddBar .AddItem("Task"),"Task",#6/11/2005#,#6/16/2005#,"" .AddBar .AddItem("Task"),"Task",#6/12/2005#,#6/15/2005#,"" End With .EndUpdate End With
VB.NET
With Exg2antt1 .BeginUpdate() With .Columns .Add("Tasks") With .Add("Duration") .set_Def(exontrol.EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,513) .Editor.EditType = exontrol.EXG2ANTTLib.EditTypeEnum.SpinType End With End With .Items.AllowCellValueToItemBar = True With .Chart .FirstWeekDay = exontrol.EXG2ANTTLib.WeekDayEnum.exMonday .LevelCount = 2 .FirstVisibleDate = #6/6/2005# .set_PaneWidth(False,128) End With With .ConditionalFormats.Add("%1 >= 4") .ApplyTo = &H1 .Bold = True .ApplyToBars = "Task" .BarColor = Color.FromArgb(255,0,0) .ForeColor = .BarColor End With With .Items .AddBar(.AddItem("Task"),"Task",#6/10/2005#,#6/13/2005#,"") .AddBar(.AddItem("Task"),"Task",#6/11/2005#,#6/16/2005#,"") .AddBar(.AddItem("Task"),"Task",#6/12/2005#,#6/15/2005#,"") End With .EndUpdate() End With
VB.NET for /COM
With AxG2antt1 .BeginUpdate() With .Columns .Add("Tasks") With .Add("Duration") .Def(EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty) = 513 .Editor.EditType = EXG2ANTTLib.EditTypeEnum.SpinType End With End With .Items.AllowCellValueToItemBar = True With .Chart .FirstWeekDay = EXG2ANTTLib.WeekDayEnum.exMonday .LevelCount = 2 .FirstVisibleDate = #6/6/2005# .PaneWidth(False) = 128 End With With .ConditionalFormats.Add("%1 >= 4") .ApplyTo = &H1 .Bold = True .ApplyToBars = "Task" .BarColor = RGB(255,0,0) .ForeColor = .BarColor End With With .Items .AddBar(.AddItem("Task"),"Task",#6/10/2005#,#6/13/2005#,"") .AddBar(.AddItem("Task"),"Task",#6/11/2005#,#6/16/2005#,"") .AddBar(.AddItem("Task"),"Task",#6/12/2005#,#6/15/2005#,"") End With .EndUpdate() End With
C++
/* 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"Duration"))); var_Column->PutDef(EXG2ANTTLib::exCellValueToItemBarProperty,long(513)); var_Column->GetEditor()->PutEditType(EXG2ANTTLib::SpinType); spG2antt1->GetItems()->PutAllowCellValueToItemBar(VARIANT_TRUE); EXG2ANTTLib::IChartPtr var_Chart = spG2antt1->GetChart(); var_Chart->PutFirstWeekDay(EXG2ANTTLib::exMonday); var_Chart->PutLevelCount(2); var_Chart->PutFirstVisibleDate(COleDateTime(2005,6,6,0,00,00).operator DATE()); var_Chart->PutPaneWidth(VARIANT_FALSE,128); EXG2ANTTLib::IConditionalFormatPtr var_ConditionalFormat = spG2antt1->GetConditionalFormats()->Add(L"%1 >= 4",vtMissing); var_ConditionalFormat->PutApplyTo(EXG2ANTTLib::FormatApplyToEnum(0x1)); var_ConditionalFormat->PutBold(VARIANT_TRUE); var_ConditionalFormat->PutApplyToBars(L"Task"); var_ConditionalFormat->PutBarColor(RGB(255,0,0)); var_ConditionalFormat->PutForeColor(var_ConditionalFormat->GetBarColor()); EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems(); var_Items->AddBar(var_Items->AddItem("Task"),"Task",COleDateTime(2005,6,10,0,00,00).operator DATE(),COleDateTime(2005,6,13,0,00,00).operator DATE(),"",vtMissing); var_Items->AddBar(var_Items->AddItem("Task"),"Task",COleDateTime(2005,6,11,0,00,00).operator DATE(),COleDateTime(2005,6,16,0,00,00).operator DATE(),"",vtMissing); var_Items->AddBar(var_Items->AddItem("Task"),"Task",COleDateTime(2005,6,12,0,00,00).operator DATE(),COleDateTime(2005,6,15,0,00,00).operator DATE(),"",vtMissing); spG2antt1->EndUpdate();
C++ Builder
G2antt1->BeginUpdate(); Exg2anttlib_tlb::IColumnsPtr var_Columns = G2antt1->Columns; var_Columns->Add(L"Tasks"); Exg2anttlib_tlb::IColumnPtr var_Column = var_Columns->Add(L"Duration"); var_Column->set_Def(Exg2anttlib_tlb::DefColumnEnum::exCellValueToItemBarProperty,TVariant(513)); var_Column->Editor->EditType = Exg2anttlib_tlb::EditTypeEnum::SpinType; G2antt1->Items->AllowCellValueToItemBar = true; Exg2anttlib_tlb::IChartPtr var_Chart = G2antt1->Chart; var_Chart->FirstWeekDay = Exg2anttlib_tlb::WeekDayEnum::exMonday; var_Chart->LevelCount = 2; var_Chart->set_FirstVisibleDate(TVariant(TDateTime(2005,6,6).operator double())); var_Chart->set_PaneWidth(false,128); Exg2anttlib_tlb::IConditionalFormatPtr var_ConditionalFormat = G2antt1->ConditionalFormats->Add(L"%1 >= 4",TNoParam()); var_ConditionalFormat->ApplyTo = Exg2anttlib_tlb::FormatApplyToEnum(0x1); var_ConditionalFormat->Bold = true; var_ConditionalFormat->ApplyToBars = L"Task"; var_ConditionalFormat->BarColor = RGB(255,0,0); var_ConditionalFormat->ForeColor = var_ConditionalFormat->BarColor; Exg2anttlib_tlb::IItemsPtr var_Items = G2antt1->Items; var_Items->AddBar(var_Items->AddItem(TVariant("Task")),TVariant("Task"),TVariant(TDateTime(2005,6,10).operator double()),TVariant(TDateTime(2005,6,13).operator double()),TVariant(""),TNoParam()); var_Items->AddBar(var_Items->AddItem(TVariant("Task")),TVariant("Task"),TVariant(TDateTime(2005,6,11).operator double()),TVariant(TDateTime(2005,6,16).operator double()),TVariant(""),TNoParam()); var_Items->AddBar(var_Items->AddItem(TVariant("Task")),TVariant("Task"),TVariant(TDateTime(2005,6,12).operator double()),TVariant(TDateTime(2005,6,15).operator double()),TVariant(""),TNoParam()); G2antt1->EndUpdate();
C#
exg2antt1.BeginUpdate(); exontrol.EXG2ANTTLib.Columns var_Columns = exg2antt1.Columns; var_Columns.Add("Tasks"); exontrol.EXG2ANTTLib.Column var_Column = (var_Columns.Add("Duration") as exontrol.EXG2ANTTLib.Column); var_Column.set_Def(exontrol.EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,513); var_Column.Editor.EditType = exontrol.EXG2ANTTLib.EditTypeEnum.SpinType; exg2antt1.Items.AllowCellValueToItemBar = true; exontrol.EXG2ANTTLib.Chart var_Chart = exg2antt1.Chart; var_Chart.FirstWeekDay = exontrol.EXG2ANTTLib.WeekDayEnum.exMonday; var_Chart.LevelCount = 2; var_Chart.FirstVisibleDate = Convert.ToDateTime("6/6/2005",System.Globalization.CultureInfo.GetCultureInfo("en-US")); var_Chart.set_PaneWidth(false,128); exontrol.EXG2ANTTLib.ConditionalFormat var_ConditionalFormat = exg2antt1.ConditionalFormats.Add("%1 >= 4",null); var_ConditionalFormat.ApplyTo = (exontrol.EXG2ANTTLib.FormatApplyToEnum)0x1; var_ConditionalFormat.Bold = true; var_ConditionalFormat.ApplyToBars = "Task"; var_ConditionalFormat.BarColor = Color.FromArgb(255,0,0); var_ConditionalFormat.ForeColor = var_ConditionalFormat.BarColor; exontrol.EXG2ANTTLib.Items var_Items = exg2antt1.Items; var_Items.AddBar(var_Items.AddItem("Task"),"Task",Convert.ToDateTime("6/10/2005",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("6/13/2005",System.Globalization.CultureInfo.GetCultureInfo("en-US")),"",null); var_Items.AddBar(var_Items.AddItem("Task"),"Task",Convert.ToDateTime("6/11/2005",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("6/16/2005",System.Globalization.CultureInfo.GetCultureInfo("en-US")),"",null); var_Items.AddBar(var_Items.AddItem("Task"),"Task",Convert.ToDateTime("6/12/2005",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("6/15/2005",System.Globalization.CultureInfo.GetCultureInfo("en-US")),"",null); exg2antt1.EndUpdate();
JScript/JavaScript
<BODY onload='Init()'> <OBJECT CLASSID="clsid:CD481F4D-2D25-4759-803F-752C568F53B7" id="G2antt1"></OBJECT> <SCRIPT LANGUAGE="JScript"> function Init() { G2antt1.BeginUpdate(); var var_Columns = G2antt1.Columns; var_Columns.Add("Tasks"); var var_Column = var_Columns.Add("Duration"); var_Column.Def(18) = 513; var_Column.Editor.EditType = 4; G2antt1.Items.AllowCellValueToItemBar = true; var var_Chart = G2antt1.Chart; var_Chart.FirstWeekDay = 1; var_Chart.LevelCount = 2; var_Chart.FirstVisibleDate = "6/6/2005"; var_Chart.PaneWidth(false) = 128; var var_ConditionalFormat = G2antt1.ConditionalFormats.Add("%1 >= 4",null); var_ConditionalFormat.ApplyTo = 1; var_ConditionalFormat.Bold = true; var_ConditionalFormat.ApplyToBars = "Task"; var_ConditionalFormat.BarColor = 255; var_ConditionalFormat.ForeColor = var_ConditionalFormat.BarColor; var var_Items = G2antt1.Items; var_Items.AddBar(var_Items.AddItem("Task"),"Task","6/10/2005","6/13/2005","",null); var_Items.AddBar(var_Items.AddItem("Task"),"Task","6/11/2005","6/16/2005","",null); var_Items.AddBar(var_Items.AddItem("Task"),"Task","6/12/2005","6/15/2005","",null); G2antt1.EndUpdate(); } </SCRIPT> </BODY>
VBScript
<BODY onload='Init()'> <OBJECT CLASSID="clsid:CD481F4D-2D25-4759-803F-752C568F53B7" id="G2antt1"></OBJECT> <SCRIPT LANGUAGE="VBScript"> Function Init() With G2antt1 .BeginUpdate With .Columns .Add "Tasks" With .Add("Duration") .Def(18) = 513 .Editor.EditType = 4 End With End With .Items.AllowCellValueToItemBar = True With .Chart .FirstWeekDay = 1 .LevelCount = 2 .FirstVisibleDate = #6/6/2005# .PaneWidth(False) = 128 End With With .ConditionalFormats.Add("%1 >= 4") .ApplyTo = 1 ' &H1 .Bold = True .ApplyToBars = "Task" .BarColor = RGB(255,0,0) .ForeColor = .BarColor End With With .Items .AddBar .AddItem("Task"),"Task",#6/10/2005#,#6/13/2005#,"" .AddBar .AddItem("Task"),"Task",#6/11/2005#,#6/16/2005#,"" .AddBar .AddItem("Task"),"Task",#6/12/2005#,#6/15/2005#,"" End With .EndUpdate End With End Function </SCRIPT> </BODY>
C# for /COM
axG2antt1.BeginUpdate(); EXG2ANTTLib.Columns var_Columns = axG2antt1.Columns; var_Columns.Add("Tasks"); EXG2ANTTLib.Column var_Column = (var_Columns.Add("Duration") as EXG2ANTTLib.Column); var_Column.set_Def(EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty,513); var_Column.Editor.EditType = EXG2ANTTLib.EditTypeEnum.SpinType; axG2antt1.Items.AllowCellValueToItemBar = true; EXG2ANTTLib.Chart var_Chart = axG2antt1.Chart; var_Chart.FirstWeekDay = EXG2ANTTLib.WeekDayEnum.exMonday; var_Chart.LevelCount = 2; var_Chart.FirstVisibleDate = Convert.ToDateTime("6/6/2005",System.Globalization.CultureInfo.GetCultureInfo("en-US")); var_Chart.set_PaneWidth(false,128); EXG2ANTTLib.ConditionalFormat var_ConditionalFormat = axG2antt1.ConditionalFormats.Add("%1 >= 4",null); var_ConditionalFormat.ApplyTo = (EXG2ANTTLib.FormatApplyToEnum)0x1; var_ConditionalFormat.Bold = true; var_ConditionalFormat.ApplyToBars = "Task"; var_ConditionalFormat.BarColor = (uint)ColorTranslator.ToWin32(Color.FromArgb(255,0,0)); var_ConditionalFormat.ForeColor = var_ConditionalFormat.BarColor; EXG2ANTTLib.Items var_Items = axG2antt1.Items; var_Items.AddBar(var_Items.AddItem("Task"),"Task",Convert.ToDateTime("6/10/2005",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("6/13/2005",System.Globalization.CultureInfo.GetCultureInfo("en-US")),"",null); var_Items.AddBar(var_Items.AddItem("Task"),"Task",Convert.ToDateTime("6/11/2005",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("6/16/2005",System.Globalization.CultureInfo.GetCultureInfo("en-US")),"",null); var_Items.AddBar(var_Items.AddItem("Task"),"Task",Convert.ToDateTime("6/12/2005",System.Globalization.CultureInfo.GetCultureInfo("en-US")),Convert.ToDateTime("6/15/2005",System.Globalization.CultureInfo.GetCultureInfo("en-US")),"",null); axG2antt1.EndUpdate();
X++ (Dynamics Ax 2009)
public void init() { COM com_Chart,com_Column,com_Columns,com_ConditionalFormat,com_Editor,com_Items; anytype var_Chart,var_Column,var_Columns,var_ConditionalFormat,var_Editor,var_Items; ; super(); exg2antt1.BeginUpdate(); var_Columns = exg2antt1.Columns(); com_Columns = var_Columns; com_Columns.Add("Tasks"); var_Column = COM::createFromVariant(com_Columns.Add("Duration")); com_Column = var_Column; com_Column.Def(18/*exCellValueToItemBarProperty*/,COMVariant::createFromInt(513)); var_Editor = COM::createFromObject(com_Column.Editor()); com_Editor = var_Editor; com_Editor.EditType(4/*SpinType*/); exg2antt1.Items().AllowCellValueToItemBar(true); var_Chart = exg2antt1.Chart(); com_Chart = var_Chart; com_Chart.FirstWeekDay(1/*exMonday*/); com_Chart.LevelCount(2); com_Chart.FirstVisibleDate(COMVariant::createFromDate(str2Date("6/6/2005",213))); /*should be called during the form's activate method*/ com_Chart.PaneWidth(false,128); var_ConditionalFormat = COM::createFromObject(exg2antt1.ConditionalFormats()).Add("%1 >= 4"); com_ConditionalFormat = var_ConditionalFormat; com_ConditionalFormat.ApplyTo(1); com_ConditionalFormat.Bold(true); com_ConditionalFormat.ApplyToBars("Task"); com_ConditionalFormat.BarColor(WinApi::RGB2int(255,0,0)); com_ConditionalFormat.ForeColor(com_ConditionalFormat.BarColor()); var_Items = exg2antt1.Items(); com_Items = var_Items; com_Items.AddBar(com_Items.AddItem("Task"),"Task",COMVariant::createFromDate(str2Date("6/10/2005",213)),COMVariant::createFromDate(str2Date("6/13/2005",213)),""); com_Items.AddBar(com_Items.AddItem("Task"),"Task",COMVariant::createFromDate(str2Date("6/11/2005",213)),COMVariant::createFromDate(str2Date("6/16/2005",213)),""); com_Items.AddBar(com_Items.AddItem("Task"),"Task",COMVariant::createFromDate(str2Date("6/12/2005",213)),COMVariant::createFromDate(str2Date("6/15/2005",213)),""); exg2antt1.EndUpdate(); } /* public void activate(boolean _active) { ; super(_active); exg2antt1.Chart().PaneWidth(false,128); } */
Delphi 8 (.NET only)
with AxG2antt1 do begin BeginUpdate(); with Columns do begin Add('Tasks'); with (Add('Duration') as EXG2ANTTLib.Column) do begin Def[EXG2ANTTLib.DefColumnEnum.exCellValueToItemBarProperty] := TObject(513); Editor.EditType := EXG2ANTTLib.EditTypeEnum.SpinType; end; end; Items.AllowCellValueToItemBar := True; with Chart do begin FirstWeekDay := EXG2ANTTLib.WeekDayEnum.exMonday; LevelCount := 2; FirstVisibleDate := '6/6/2005'; PaneWidth[False] := 128; end; with ConditionalFormats.Add('%1 >= 4',Nil) do begin ApplyTo := EXG2ANTTLib.FormatApplyToEnum($1); Bold := True; ApplyToBars := 'Task'; BarColor := $ff; ForeColor := BarColor; end; with Items do begin AddBar(AddItem('Task'),'Task','6/10/2005','6/13/2005','',Nil); AddBar(AddItem('Task'),'Task','6/11/2005','6/16/2005','',Nil); AddBar(AddItem('Task'),'Task','6/12/2005','6/15/2005','',Nil); end; EndUpdate(); end
Delphi (standard)
with G2antt1 do begin BeginUpdate(); with Columns do begin Add('Tasks'); with (IUnknown(Add('Duration')) as EXG2ANTTLib_TLB.Column) do begin Def[EXG2ANTTLib_TLB.exCellValueToItemBarProperty] := OleVariant(513); Editor.EditType := EXG2ANTTLib_TLB.SpinType; end; end; Items.AllowCellValueToItemBar := True; with Chart do begin FirstWeekDay := EXG2ANTTLib_TLB.exMonday; LevelCount := 2; FirstVisibleDate := '6/6/2005'; PaneWidth[False] := 128; end; with ConditionalFormats.Add('%1 >= 4',Null) do begin ApplyTo := EXG2ANTTLib_TLB.FormatApplyToEnum($1); Bold := True; ApplyToBars := 'Task'; BarColor := $ff; ForeColor := BarColor; end; with Items do begin AddBar(AddItem('Task'),'Task','6/10/2005','6/13/2005','',Null); AddBar(AddItem('Task'),'Task','6/11/2005','6/16/2005','',Null); AddBar(AddItem('Task'),'Task','6/12/2005','6/15/2005','',Null); end; EndUpdate(); end
VFP
with thisform.G2antt1 .BeginUpdate with .Columns .Add("Tasks") with .Add("Duration") .Def(18) = 513 .Editor.EditType = 4 endwith endwith .Items.AllowCellValueToItemBar = .T. with .Chart .FirstWeekDay = 1 .LevelCount = 2 .FirstVisibleDate = {^2005-6-6} .PaneWidth(0) = 128 endwith with .ConditionalFormats.Add("%1 >= 4") .ApplyTo = 1 && 0x1 .Bold = .T. .ApplyToBars = "Task" .BarColor = RGB(255,0,0) .ForeColor = .BarColor endwith with .Items .AddBar(.AddItem("Task"),"Task",{^2005-6-10},{^2005-6-13},"") .AddBar(.AddItem("Task"),"Task",{^2005-6-11},{^2005-6-16},"") .AddBar(.AddItem("Task"),"Task",{^2005-6-12},{^2005-6-15},"") endwith .EndUpdate endwith
dBASE Plus
local oG2antt,var_Chart,var_Column,var_Columns,var_ConditionalFormat,var_Items oG2antt = form.Activex1.nativeObject oG2antt.BeginUpdate() var_Columns = oG2antt.Columns var_Columns.Add("Tasks") var_Column = var_Columns.Add("Duration") // var_Column.Def(18) = 513 with (oG2antt) TemplateDef = [Dim var_Column] TemplateDef = var_Column Template = [var_Column.Def(18) = 513] endwith var_Column.Editor.EditType = 4 oG2antt.Items.AllowCellValueToItemBar = true var_Chart = oG2antt.Chart var_Chart.FirstWeekDay = 1 var_Chart.LevelCount = 2 var_Chart.FirstVisibleDate = "06/06/2005" // var_Chart.PaneWidth(false) = 128 with (oG2antt) TemplateDef = [Dim var_Chart] TemplateDef = var_Chart Template = [var_Chart.PaneWidth(false) = 128] endwith var_ConditionalFormat = oG2antt.ConditionalFormats.Add("%1 >= 4") var_ConditionalFormat.ApplyTo = 1 /*0x1 | */ var_ConditionalFormat.Bold = true var_ConditionalFormat.ApplyToBars = "Task" var_ConditionalFormat.BarColor = 0xff var_ConditionalFormat.ForeColor = var_ConditionalFormat.BarColor var_Items = oG2antt.Items var_Items.AddBar(var_Items.AddItem("Task"),"Task","06/10/2005","06/13/2005","") var_Items.AddBar(var_Items.AddItem("Task"),"Task","06/11/2005","06/16/2005","") var_Items.AddBar(var_Items.AddItem("Task"),"Task","06/12/2005","06/15/2005","") oG2antt.EndUpdate()
XBasic (Alpha Five)
Dim oG2antt as P Dim var_Chart as P Dim var_Column as P Dim var_Columns as P Dim var_ConditionalFormat as P Dim var_Items as P oG2antt = topparent:CONTROL_ACTIVEX1.activex oG2antt.BeginUpdate() var_Columns = oG2antt.Columns var_Columns.Add("Tasks") var_Column = var_Columns.Add("Duration") ' var_Column.Def(18) = 513 oG2antt.TemplateDef = "Dim var_Column" oG2antt.TemplateDef = var_Column oG2antt.Template = "var_Column.Def(18) = 513" var_Column.Editor.EditType = 4 oG2antt.Items.AllowCellValueToItemBar = .t. var_Chart = oG2antt.Chart var_Chart.FirstWeekDay = 1 var_Chart.LevelCount = 2 var_Chart.FirstVisibleDate = {06/06/2005} ' var_Chart.PaneWidth(.f.) = 128 oG2antt.TemplateDef = "Dim var_Chart" oG2antt.TemplateDef = var_Chart oG2antt.Template = "var_Chart.PaneWidth(False) = 128" var_ConditionalFormat = oG2antt.ConditionalFormats.Add("%1 >= 4") var_ConditionalFormat.ApplyTo = 1 '1 + var_ConditionalFormat.Bold = .t. var_ConditionalFormat.ApplyToBars = "Task" var_ConditionalFormat.BarColor = 255 var_ConditionalFormat.ForeColor = var_ConditionalFormat.BarColor var_Items = oG2antt.Items var_Items.AddBar(var_Items.AddItem("Task"),"Task",{06/10/2005},{06/13/2005},"") var_Items.AddBar(var_Items.AddItem("Task"),"Task",{06/11/2005},{06/16/2005},"") var_Items.AddBar(var_Items.AddItem("Task"),"Task",{06/12/2005},{06/15/2005},"") oG2antt.EndUpdate()
Visual Objects
local var_Chart as IChart local var_Column as IColumn local var_Columns as IColumns local var_ConditionalFormat as IConditionalFormat local var_Items as IItems oDCOCX_Exontrol1:BeginUpdate() var_Columns := oDCOCX_Exontrol1:Columns var_Columns:Add("Tasks") var_Column := IColumn{var_Columns:Add("Duration")} var_Column:[Def,exCellValueToItemBarProperty] := 513 var_Column:Editor:EditType := SpinType oDCOCX_Exontrol1:Items:AllowCellValueToItemBar := true var_Chart := oDCOCX_Exontrol1:Chart var_Chart:FirstWeekDay := exMonday var_Chart:LevelCount := 2 var_Chart:FirstVisibleDate := SToD("20050606") var_Chart:[PaneWidth,false] := 128 var_ConditionalFormat := oDCOCX_Exontrol1:ConditionalFormats:Add("%1 >= 4",nil) var_ConditionalFormat:ApplyTo := 0x1 | var_ConditionalFormat:Bold := true var_ConditionalFormat:ApplyToBars := "Task" var_ConditionalFormat:BarColor := RGB(255,0,0) var_ConditionalFormat:ForeColor := var_ConditionalFormat:BarColor var_Items := oDCOCX_Exontrol1:Items var_Items:AddBar(var_Items:AddItem("Task"),"Task",SToD("20050610"),SToD("20050613"),"",nil) var_Items:AddBar(var_Items:AddItem("Task"),"Task",SToD("20050611"),SToD("20050616"),"",nil) var_Items:AddBar(var_Items:AddItem("Task"),"Task",SToD("20050612"),SToD("20050615"),"",nil) oDCOCX_Exontrol1:EndUpdate()
PowerBuilder
OleObject oG2antt,var_Chart,var_Column,var_Columns,var_ConditionalFormat,var_Items oG2antt = ole_1.Object oG2antt.BeginUpdate() var_Columns = oG2antt.Columns var_Columns.Add("Tasks") var_Column = var_Columns.Add("Duration") var_Column.Def(18,513) var_Column.Editor.EditType = 4 oG2antt.Items.AllowCellValueToItemBar = true var_Chart = oG2antt.Chart var_Chart.FirstWeekDay = 1 var_Chart.LevelCount = 2 var_Chart.FirstVisibleDate = 2005-06-06 var_Chart.PaneWidth(false,128) var_ConditionalFormat = oG2antt.ConditionalFormats.Add("%1 >= 4") var_ConditionalFormat.ApplyTo = 1 /*1 /*0x1*/ | */ var_ConditionalFormat.Bold = true var_ConditionalFormat.ApplyToBars = "Task" var_ConditionalFormat.BarColor = RGB(255,0,0) var_ConditionalFormat.ForeColor = var_ConditionalFormat.BarColor var_Items = oG2antt.Items var_Items.AddBar(var_Items.AddItem("Task"),"Task",2005-06-10,2005-06-13,"") var_Items.AddBar(var_Items.AddItem("Task"),"Task",2005-06-11,2005-06-16,"") var_Items.AddBar(var_Items.AddItem("Task"),"Task",2005-06-12,2005-06-15,"") oG2antt.EndUpdate()
Visual DataFlex
Procedure OnCreate Forward Send OnCreate Send ComBeginUpdate Variant voColumns Get ComColumns to voColumns Handle hoColumns Get Create (RefClass(cComColumns)) to hoColumns Set pvComObject of hoColumns to voColumns Get ComAdd of hoColumns "Tasks" to Nothing Variant voColumn Get ComAdd of hoColumns "Duration" to voColumn Handle hoColumn Get Create (RefClass(cComColumn)) to hoColumn Set pvComObject of hoColumn to voColumn Set ComDef of hoColumn OLEexCellValueToItemBarProperty to 513 Variant voEditor Get ComEditor of hoColumn to voEditor Handle hoEditor Get Create (RefClass(cComEditor)) to hoEditor Set pvComObject of hoEditor to voEditor Set ComEditType of hoEditor to OLESpinType Send Destroy to hoEditor Send Destroy to hoColumn Send Destroy to hoColumns Variant voItems Get ComItems to voItems Handle hoItems Get Create (RefClass(cComItems)) to hoItems Set pvComObject of hoItems to voItems Set ComAllowCellValueToItemBar of hoItems to True Send Destroy to hoItems Variant voChart Get ComChart to voChart Handle hoChart Get Create (RefClass(cComChart)) to hoChart Set pvComObject of hoChart to voChart Set ComFirstWeekDay of hoChart to OLEexMonday Set ComLevelCount of hoChart to 2 Set ComFirstVisibleDate of hoChart to "6/6/2005" Set ComPaneWidth of hoChart False to 128 Send Destroy to hoChart Variant voConditionalFormats Get ComConditionalFormats to voConditionalFormats Handle hoConditionalFormats Get Create (RefClass(cComConditionalFormats)) to hoConditionalFormats Set pvComObject of hoConditionalFormats to voConditionalFormats Variant voConditionalFormat Get ComAdd of hoConditionalFormats "%1 >= 4" Nothing to voConditionalFormat Handle hoConditionalFormat Get Create (RefClass(cComConditionalFormat)) to hoConditionalFormat Set pvComObject of hoConditionalFormat to voConditionalFormat Set ComApplyTo of hoConditionalFormat to |CI$1 Set ComBold of hoConditionalFormat to True Set ComApplyToBars of hoConditionalFormat to "Task" Set ComBarColor of hoConditionalFormat to (RGB(255,0,0)) Set ComForeColor of hoConditionalFormat to (ComBarColor(hoConditionalFormat)) Send Destroy to hoConditionalFormat Send Destroy to hoConditionalFormats Variant voItems1 Get ComItems to voItems1 Handle hoItems1 Get Create (RefClass(cComItems)) to hoItems1 Set pvComObject of hoItems1 to voItems1 Send ComAddBar of hoItems1 (ComAddItem(hoItems1,"Task")) "Task" "6/10/2005" "6/13/2005" "" Nothing Send ComAddBar of hoItems1 (ComAddItem(hoItems1,"Task")) "Task" "6/11/2005" "6/16/2005" "" Nothing Send ComAddBar of hoItems1 (ComAddItem(hoItems1,"Task")) "Task" "6/12/2005" "6/15/2005" "" Nothing Send Destroy to hoItems1 Send ComEndUpdate End_Procedure
XBase++
#include "AppEvent.ch" #include "ActiveX.ch" PROCEDURE Main LOCAL oForm LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL LOCAL oG2antt LOCAL oChart LOCAL oColumn LOCAL oColumns LOCAL oConditionalFormat LOCAL oItems oForm := XbpDialog():new( AppDesktop() ) oForm:drawingArea:clipChildren := .T. oForm:create( ,,{100,100}, {640,480},, .F. ) oForm:close := {|| PostAppEvent( xbeP_Quit )} oG2antt := XbpActiveXControl():new( oForm:drawingArea ) oG2antt:CLSID := "Exontrol.G2antt.1" /*{CD481F4D-2D25-4759-803F-752C568F53B7}*/ oG2antt:create(,, {10,60},{610,370} ) oG2antt:BeginUpdate() oColumns := oG2antt:Columns() oColumns:Add("Tasks") oColumn := oColumns:Add("Duration") oColumn:SetProperty("Def",18/*exCellValueToItemBarProperty*/,513) oColumn:Editor():EditType := 4/*SpinType*/ oG2antt:Items():AllowCellValueToItemBar := .T. oChart := oG2antt:Chart() oChart:FirstWeekDay := 1/*exMonday*/ oChart:LevelCount := 2 oChart:FirstVisibleDate := "06/06/2005" oChart:SetProperty("PaneWidth",.F.,128) oConditionalFormat := oG2antt:ConditionalFormats():Add("%1 >= 4") oConditionalFormat:ApplyTo := 1/*0x1+*/ oConditionalFormat:Bold := .T. oConditionalFormat:ApplyToBars := "Task" oConditionalFormat:SetProperty("BarColor",AutomationTranslateColor( GraMakeRGBColor ( { 255,0,0 } ) , .F. )) oConditionalFormat:SetProperty("ForeColor",oConditionalFormat:BarColor()) oItems := oG2antt:Items() oItems:AddBar(oItems:AddItem("Task"),"Task","06/10/2005","06/13/2005","") oItems:AddBar(oItems:AddItem("Task"),"Task","06/11/2005","06/16/2005","") oItems:AddBar(oItems:AddItem("Task"),"Task","06/12/2005","06/15/2005","") oG2antt:EndUpdate() oForm:Show() DO WHILE nEvent != xbeP_Quit nEvent := AppEvent( @mp1, @mp2, @oXbp ) oXbp:handleEvent( nEvent, mp1, mp2 ) ENDDO RETURN