method Chart.UndoRemoveAction ([Action as Variant], [Count as Variant])
Removes the last the undo actions that can be performed in the chart.

TypeDescription
Action as Variant [optional] A long expression that specifies the action being removed. If missing or -1, all actions are removed from the undo queue.

The Action parameter can be one of the following:

  • exChartUndoRedoAddBar(0) ~ "AddBar;ITEMINDEX;KEY", indicates that a new bar has been created
  • exChartUndoRedoRemoveBar(1) ~ "RemoveBar;ITEMINDEX;KEY", indicates that a bar has been removed
  • exChartUndoRedoMoveBar(2) ~ "MoveBar;ITEMINDEX;KEY", indicates that a bar has been moved or resized
  • exChartUndoRedoPercentChange(3) ~ "PercentChange;ITEMINDEX;KEY", indicates that the bar's percent has been changed
  • exChartUndoRedoUpdateBar(4) ~ "UpdateBar;ITEMINDEX;KEY", indicates that one or more properties of the bar has been updated (ItemBar property, this operation can be added only using the StartUpdateBar / EndUpdateBar methods)
  • exChartUndoRedoParentChangeBar(5) ~ "ParentChangeBar;ITEMINDEX;KEY", indicates that the bar's parent has been changed
  • exChartUndoRedoGroupBars(6) ~ "GroupBars;ITEMINDEXA;KEYA;STARTA;ITEMINDEXB;KEYB;STARTB", specifies that two bars has been grouped
  • exChartUndoRedoUngroupBars(7) ~ "UngroupBars;ITEMINDEXA;KEYA;STARTA;ITEMINDEXB;KEYB;STARTB", specifies that two bars has been ungrouped
  • exChartUndoRedoDefineSummaryBars(8) ~ "DefineSummaryBars;SUMMARYITEMINDEX;SUMMARYKEY;ITEMINDEX;KEY", indicates that a bar has been defined as a child of a summary bar
  • exChartUndoRedoUndefineSummaryBars(9) ~ "UndefineSummaryBars;SUMMARYITEMINDEX;SUMMARYKEY;ITEMINDEX;KEY", indicates that a bar has been removed from the summary bar's children
  • exChartUndoRedoAddLink(10) ~ "AddLink;KEY", indicates that a new link has been created
  • exChartUndoRedoRemoveLink(11) ~ "RemoveLink;KEY", indicates that a link has been removed
  • exChartUndoRedoUpdateLink(12) ~ "UpdateLink;KEY", specifies that one of more properties of the link has been updated (Link property, this operation can be added only using the StartUpdateLink / EndUpdateLink methods)
  • exListUndoRedoAddItem(13) ~ "AddItem;ITEMINDEX", indicates that a new item has been created
  • exListUndoRedoRemoveItem(14) ~ "RemoveItem;ITEMINDEX", indicates that an item has been removed
  • exListUndoRedoChangeItemPos(15) ~ "ChangeItemPos;ITEMINDEX", indicates that an item changes its position or / and parent
  • exListUndoRedoChangeCellValue(16) ~ "ChangeCellValue;ITEMINDEX;CELLINDEX", indicates that the cell's value has been changed
  • exListUndoRedoChangeCellState(17) ~ "ChangeCellState;ITEMINDEX;CELLINDEX", indicates that the cell's state has been changed

For instance, UndoRemoveAction(0) removes only AddBar actions in the undo stack.

Count as Variant [optional] A long expression that indicates the number of actions to be removed. If missing or -1, all actions are removed. For instance, UndoRemoveAction(0,1) removes only the last AddBar action from the undo stack
Use the UndoRemoveAction method to remove the last action from the undo queue. Use the UndoRemoveAction() ( with no parameters ) to remove all undo actions. The UndoListAction property retrieves the list of actions that an undo operation can perform. The RedoRemoveAction method removes the first action to be performed if the Redo method is invoked. For instance, let's say that during the AddLink event, you decide that the link being added should be removed, and so, you do not need to record the last RemoveLink action. In other words, you need to call the UndoRemoveAction( exChartUndoRedoRemoveLink, 1 ) removes the last RemoveLink action from the undo stack.

The records of the Undo/Redo queue may contain actions in the following format:

The records of the Undo/Redo queue may contain actions in the following format (available starting from 23.0):

Also, the Undo/Redo queue may include:

The following samples shows preventing adding the AddLink and RemoveLink undo operations when  AddLink event occurs. 

VBA (MS Access, Excell...)

' AddLink event - Occurs when the user links two bars using the mouse.
Private Sub G2antt1_AddLink(ByVal LinkKey As String)
	With G2antt1
		.Items.RemoveLink LinkKey
		.Chart.UndoRemoveAction 7,1
		.Chart.UndoRemoveAction 8,1
		Debug.Print(.Chart.UndoListAction())
	End With
End Sub

' ChartEndChanging event - Occurs after the chart has been changed.
Private Sub G2antt1_ChartEndChanging(ByVal Operation As Long)
	With G2antt1
		Debug.Print(.Chart.UndoListAction())
	End With
End Sub

With G2antt1
	.BeginUpdate 
	.Columns.Add "Tasks"
	With .Chart
		.AllowUndoRedo = True
		.FirstVisibleDate = #6/20/2005#
		.AllowLinkBars = True
		.LevelCount = 2
		.PaneWidth(0) = 48
	End With
	With .Items
		.AddBar .AddItem("Task 1"),"Task",#6/21/2005#,#6/25/2005#,""
		.AddBar .AddItem("Task 2"),"Task",#6/28/2005#,#7/2/2005#,""
	End With
	.EndUpdate 
End With

VB6

' AddLink event - Occurs when the user links two bars using the mouse.
Private Sub G2antt1_AddLink(ByVal LinkKey As String)
	With G2antt1
		.Items.RemoveLink LinkKey
		.Chart.UndoRemoveAction 7,1
		.Chart.UndoRemoveAction 8,1
		Debug.Print(.Chart.UndoListAction())
	End With
End Sub

' ChartEndChanging event - Occurs after the chart has been changed.
Private Sub G2antt1_ChartEndChanging(ByVal Operation As EXG2ANTTLibCtl.BarOperationEnum)
	With G2antt1
		Debug.Print(.Chart.UndoListAction())
	End With
End Sub

With G2antt1
	.BeginUpdate 
	.Columns.Add "Tasks"
	With .Chart
		.AllowUndoRedo = True
		.FirstVisibleDate = #6/20/2005#
		.AllowLinkBars = True
		.LevelCount = 2
		.PaneWidth(0) = 48
	End With
	With .Items
		.AddBar .AddItem("Task 1"),"Task",#6/21/2005#,#6/25/2005#,""
		.AddBar .AddItem("Task 2"),"Task",#6/28/2005#,#7/2/2005#,""
	End With
	.EndUpdate 
End With

VB.NET

' AddLink event - Occurs when the user links two bars using the mouse.
Private Sub Exg2antt1_AddLink(ByVal sender As System.Object,ByVal LinkKey As String) Handles Exg2antt1.AddLink
	With Exg2antt1
		.Items.RemoveLink(LinkKey)
		.Chart.UndoRemoveAction(7,1)
		.Chart.UndoRemoveAction(8,1)
		Debug.Print(.Chart.get_UndoListAction())
	End With
End Sub

' ChartEndChanging event - Occurs after the chart has been changed.
Private Sub Exg2antt1_ChartEndChanging(ByVal sender As System.Object,ByVal Operation As exontrol.EXG2ANTTLib.BarOperationEnum) Handles Exg2antt1.ChartEndChanging
	With Exg2antt1
		Debug.Print(.Chart.get_UndoListAction())
	End With
End Sub

With Exg2antt1
	.BeginUpdate()
	.Columns.Add("Tasks")
	With .Chart
		.AllowUndoRedo = True
		.FirstVisibleDate = #6/20/2005#
		.AllowLinkBars = True
		.LevelCount = 2
		.set_PaneWidth(False,48)
	End With
	With .Items
		.AddBar(.AddItem("Task 1"),"Task",#6/21/2005#,#6/25/2005#,"")
		.AddBar(.AddItem("Task 2"),"Task",#6/28/2005#,#7/2/2005#,"")
	End With
	.EndUpdate()
End With

VB.NET for /COM

' AddLink event - Occurs when the user links two bars using the mouse.
Private Sub AxG2antt1_AddLink(ByVal sender As System.Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_AddLinkEvent) Handles AxG2antt1.AddLink
	With AxG2antt1
		.Items.RemoveLink(e.linkKey)
		.Chart.UndoRemoveAction(7,1)
		.Chart.UndoRemoveAction(8,1)
		Debug.Print(.Chart.UndoListAction())
	End With
End Sub

' ChartEndChanging event - Occurs after the chart has been changed.
Private Sub AxG2antt1_ChartEndChanging(ByVal sender As System.Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_ChartEndChangingEvent) Handles AxG2antt1.ChartEndChanging
	With AxG2antt1
		Debug.Print(.Chart.UndoListAction())
	End With
End Sub

With AxG2antt1
	.BeginUpdate()
	.Columns.Add("Tasks")
	With .Chart
		.AllowUndoRedo = True
		.FirstVisibleDate = #6/20/2005#
		.AllowLinkBars = True
		.LevelCount = 2
		.PaneWidth(False) = 48
	End With
	With .Items
		.AddBar(.AddItem("Task 1"),"Task",#6/21/2005#,#6/25/2005#,"")
		.AddBar(.AddItem("Task 2"),"Task",#6/28/2005#,#7/2/2005#,"")
	End With
	.EndUpdate()
End With

C++

// AddLink event - Occurs when the user links two bars using the mouse.
void OnAddLinkG2antt1(LPCTSTR LinkKey)
{
	/*
		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->GetItems()->RemoveLink(LinkKey);
	spG2antt1->GetChart()->UndoRemoveAction(long(7),long(1));
	spG2antt1->GetChart()->UndoRemoveAction(long(8),long(1));
	OutputDebugStringW(spG2antt1->GetChart()->GetUndoListAction(vtMissing,vtMissing));
}

// ChartEndChanging event - Occurs after the chart has been changed.
void OnChartEndChangingG2antt1(long Operation)
{
	EXG2ANTTLib::IG2anttPtr spG2antt1 = GetDlgItem(IDC_G2ANTT1)->GetControlUnknown();
	OutputDebugStringW(spG2antt1->GetChart()->GetUndoListAction(vtMissing,vtMissing));
}

EXG2ANTTLib::IG2anttPtr spG2antt1 = GetDlgItem(IDC_G2ANTT1)->GetControlUnknown();
spG2antt1->BeginUpdate();
spG2antt1->GetColumns()->Add(L"Tasks");
EXG2ANTTLib::IChartPtr var_Chart = spG2antt1->GetChart();
	var_Chart->PutAllowUndoRedo(VARIANT_TRUE);
	var_Chart->PutFirstVisibleDate("6/20/2005");
	var_Chart->PutAllowLinkBars(VARIANT_TRUE);
	var_Chart->PutLevelCount(2);
	var_Chart->PutPaneWidth(VARIANT_FALSE,48);
EXG2ANTTLib::IItemsPtr var_Items = spG2antt1->GetItems();
	var_Items->AddBar(var_Items->AddItem("Task 1"),"Task","6/21/2005","6/25/2005","",vtMissing);
	var_Items->AddBar(var_Items->AddItem("Task 2"),"Task","6/28/2005","7/2/2005","",vtMissing);
spG2antt1->EndUpdate();

C#

// AddLink event - Occurs when the user links two bars using the mouse.
private void exg2antt1_AddLink(object sender,string LinkKey)
{
	exg2antt1.Items.RemoveLink(LinkKey);
	exg2antt1.Chart.UndoRemoveAction(7,1);
	exg2antt1.Chart.UndoRemoveAction(8,1);
	System.Diagnostics.Debug.Print(exg2antt1.Chart.get_UndoListAction(null,null));
}
//this.exg2antt1.AddLink += new exontrol.EXG2ANTTLib.exg2antt.AddLinkEventHandler(this.exg2antt1_AddLink);

// ChartEndChanging event - Occurs after the chart has been changed.
private void exg2antt1_ChartEndChanging(object sender,exontrol.EXG2ANTTLib.BarOperationEnum Operation)
{
	System.Diagnostics.Debug.Print(exg2antt1.Chart.get_UndoListAction(null,null));
}
//this.exg2antt1.ChartEndChanging += new exontrol.EXG2ANTTLib.exg2antt.ChartEndChangingEventHandler(this.exg2antt1_ChartEndChanging);

exg2antt1.BeginUpdate();
exg2antt1.Columns.Add("Tasks");
exontrol.EXG2ANTTLib.Chart var_Chart = exg2antt1.Chart;
	var_Chart.AllowUndoRedo = true;
	var_Chart.FirstVisibleDate = Convert.ToDateTime("6/20/2005");
	var_Chart.AllowLinkBars = true;
	var_Chart.LevelCount = 2;
	var_Chart.set_PaneWidth(false,48);
exontrol.EXG2ANTTLib.Items var_Items = exg2antt1.Items;
	var_Items.AddBar(var_Items.AddItem("Task 1"),"Task",Convert.ToDateTime("6/21/2005"),Convert.ToDateTime("6/25/2005"),"",null);
	var_Items.AddBar(var_Items.AddItem("Task 2"),"Task",Convert.ToDateTime("6/28/2005"),Convert.ToDateTime("7/2/2005"),"",null);
exg2antt1.EndUpdate();

C# for /COM

// AddLink event - Occurs when the user links two bars using the mouse.
private void axG2antt1_AddLink(object sender, AxEXG2ANTTLib._IG2anttEvents_AddLinkEvent e)
{
	axG2antt1.Items.RemoveLink(e.linkKey);
	axG2antt1.Chart.UndoRemoveAction(7,1);
	axG2antt1.Chart.UndoRemoveAction(8,1);
	System.Diagnostics.Debug.Print(axG2antt1.Chart.get_UndoListAction(null,null));
}
//this.axG2antt1.AddLink += new AxEXG2ANTTLib._IG2anttEvents_AddLinkEventHandler(this.axG2antt1_AddLink);

// ChartEndChanging event - Occurs after the chart has been changed.
private void axG2antt1_ChartEndChanging(object sender, AxEXG2ANTTLib._IG2anttEvents_ChartEndChangingEvent e)
{
	System.Diagnostics.Debug.Print(axG2antt1.Chart.get_UndoListAction(null,null));
}
//this.axG2antt1.ChartEndChanging += new AxEXG2ANTTLib._IG2anttEvents_ChartEndChangingEventHandler(this.axG2antt1_ChartEndChanging);

axG2antt1.BeginUpdate();
axG2antt1.Columns.Add("Tasks");
EXG2ANTTLib.Chart var_Chart = axG2antt1.Chart;
	var_Chart.AllowUndoRedo = true;
	var_Chart.FirstVisibleDate = Convert.ToDateTime("6/20/2005");
	var_Chart.AllowLinkBars = true;
	var_Chart.LevelCount = 2;
	var_Chart.set_PaneWidth(false,48);
EXG2ANTTLib.Items var_Items = axG2antt1.Items;
	var_Items.AddBar(var_Items.AddItem("Task 1"),"Task",Convert.ToDateTime("6/21/2005"),Convert.ToDateTime("6/25/2005"),"",null);
	var_Items.AddBar(var_Items.AddItem("Task 2"),"Task",Convert.ToDateTime("6/28/2005"),Convert.ToDateTime("7/2/2005"),"",null);
axG2antt1.EndUpdate();

Delphi 8 (.NET only)

// AddLink event - Occurs when the user links two bars using the mouse.
procedure TWinForm1.AxG2antt1_AddLink(sender: System.Object; e: AxEXG2ANTTLib._IG2anttEvents_AddLinkEvent);
begin
	with AxG2antt1 do
	begin
		Items.RemoveLink(TObject(e.linkKey));
		Chart.UndoRemoveAction(TObject(7),TObject(1));
		Chart.UndoRemoveAction(TObject(8),TObject(1));
		OutputDebugString(Chart.UndoListAction[Nil,Nil]);
	end
end;

// ChartEndChanging event - Occurs after the chart has been changed.
procedure TWinForm1.AxG2antt1_ChartEndChanging(sender: System.Object; e: AxEXG2ANTTLib._IG2anttEvents_ChartEndChangingEvent);
begin
	with AxG2antt1 do
	begin
		OutputDebugString(Chart.UndoListAction[Nil,Nil]);
	end
end;

with AxG2antt1 do
begin
	BeginUpdate();
	Columns.Add('Tasks');
	with Chart do
	begin
		AllowUndoRedo := True;
		FirstVisibleDate := '6/20/2005';
		AllowLinkBars := True;
		LevelCount := 2;
		PaneWidth[False] := 48;
	end;
	with Items do
	begin
		AddBar(AddItem('Task 1'),'Task','6/21/2005','6/25/2005','',Nil);
		AddBar(AddItem('Task 2'),'Task','6/28/2005','7/2/2005','',Nil);
	end;
	EndUpdate();
end

Delphi (standard)

// AddLink event - Occurs when the user links two bars using the mouse.
procedure TForm1.G2antt1AddLink(ASender: TObject; LinkKey : WideString);
begin
	with G2antt1 do
	begin
		Items.RemoveLink(OleVariant(LinkKey));
		Chart.UndoRemoveAction(OleVariant(7),OleVariant(1));
		Chart.UndoRemoveAction(OleVariant(8),OleVariant(1));
		OutputDebugString(Chart.UndoListAction[Null,Null]);
	end
end;

// ChartEndChanging event - Occurs after the chart has been changed.
procedure TForm1.G2antt1ChartEndChanging(ASender: TObject; Operation : BarOperationEnum);
begin
	with G2antt1 do
	begin
		OutputDebugString(Chart.UndoListAction[Null,Null]);
	end
end;

with G2antt1 do
begin
	BeginUpdate();
	Columns.Add('Tasks');
	with Chart do
	begin
		AllowUndoRedo := True;
		FirstVisibleDate := '6/20/2005';
		AllowLinkBars := True;
		LevelCount := 2;
		PaneWidth[False] := 48;
	end;
	with Items do
	begin
		AddBar(AddItem('Task 1'),'Task','6/21/2005','6/25/2005','',Null);
		AddBar(AddItem('Task 2'),'Task','6/28/2005','7/2/2005','',Null);
	end;
	EndUpdate();
end

VFP

*** AddLink event - Occurs when the user links two bars using the mouse. ***
LPARAMETERS LinkKey
	with thisform.G2antt1
		.Items.RemoveLink(LinkKey)
		.Chart.UndoRemoveAction(7,1)
		.Chart.UndoRemoveAction(8,1)
		DEBUGOUT(.Chart.UndoListAction())
	endwith

*** ChartEndChanging event - Occurs after the chart has been changed. ***
LPARAMETERS Operation
	with thisform.G2antt1
		DEBUGOUT(.Chart.UndoListAction())
	endwith

with thisform.G2antt1
	.BeginUpdate
	.Columns.Add("Tasks")
	with .Chart
		.AllowUndoRedo = .T.
		.FirstVisibleDate = {^2005-6-20}
		.AllowLinkBars = .T.
		.LevelCount = 2
		.PaneWidth(0) = 48
	endwith
	with .Items
		.AddBar(.AddItem("Task 1"),"Task",{^2005-6-21},{^2005-6-25},"")
		.AddBar(.AddItem("Task 2"),"Task",{^2005-6-28},{^2005-7-2},"")
	endwith
	.EndUpdate
endwith