|Item as HITEM||A long expression that specifies the handle of the item that holds the bar to be updated.|
|BarKey as Variant||A VARIANT expression that holds the key of the bar being updated. Use the AddBar method to add programmatically bars.|
|Long||A Long expression that specifies the handle to be passed to EndUpdateBar so the updated properties of the bar are added to the Undo/Redo queue of the chart, so they can be used in undo/redo operations.|
The AllowUndoRedo property specifies whether the chart supports undo/redo operations for objects in the chart such as bars or links. The ChartStartChanging(exUndo/exRedo) / ChartEndChanging(exUndo/exRedo) event notifies your application whenever an Undo/Redo operation is performed. The UndoListAction property lists the Undo actions that can be performed in the chart. The RedoListAction property lists the Redo actions that can be performed in the chart.
The following VB sample adds a new entry "UpdateBar" in the chart's undo/redo queue for changing the text of the bar ( /COM version ):
With G2antt1.Items Dim hItem As Long hItem = .FocusItem Dim barKey As Variant barKey = .FirstItemBar(hItem) Dim iChangeBar As Long iChangeBar = .StartUpdateBar(hItem, barKey) .ItemBar(hItem, barKey, exBarCaption) = "new caption" .EndUpdateBar (iChangeBar) End With
The following VB/NET sample adds a new entry "UpdateBar" in the chart's undo/redo queue for changing the text of the bar ( /NET Assembly version ):
With Exg2antt1.Items Dim hItem As Long = .FocusItem Dim barKey As Object = .get_FirstItemBar(hItem) Dim iChangeBar As Long = .get_StartUpdateBar(hItem, barKey) .set_ItemBar(hItem, barKey, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCaption, "new caption") .EndUpdateBar(iChangeBar) End With
These samples add new entries to undo/redo queue as : "UpdateBar;94980832;B1;3;;new caption " which indicates , the handle of the items where the bar has been changed, the bar of the key as being B1, the 3 indicates the exBarCaption predefined value, and so on. Once the sample is called, the bar's caption is changed, and using the CTRL + Z, you can restore back the old value, or pressing the CTRL + Y you can change back after restoring.