AnnAddUndoNode Example for Delphi
var
//Global declarations
RasterAnn: LEADRasterAnnotation;
RasterAnnToolbar: LEADRasterAnnToolBar;
procedure TForm1.Button1Click(Sender: TObject);
begin
RasterAnn:= CoLEADRasterAnnotation.Create ();
RasterAnnToolbar:= CoLEADRasterAnnToolBar.Create ();
RasterAnn.AnnParentRasterView := LEADRasterView1.Raster;
LEADEventSink1.Connect (RasterAnn, _LEADRasterAnnotationEvents);
RasterAnn.AnnUserMode := ANN_USERMODE_DESIGN ;
end;
//This example creates two annotation notes as a single undo operation
procedure TForm1.Button2Click(Sender: TObject);
var
hObject1: Longint;
hObject2: Longint;
begin
//Call the AddUndoNode method to add an undo node to the container.
RasterAnn.AnnAddUndoNode ();
//Disable the undo feature
RasterAnn.AnnUndoEnable := False;
//Perform the operations to be combined into one undo.
RasterAnn.AnnCreate (ANN_OBJECT_NOTE, True, True);
hObject1:= RasterAnn.AnnObject;
RasterAnn.AnnRectLeft [hObject1] := 0;
RasterAnn.AnnRectTop [hObject1] := 0;
RasterAnn.AnnRectWidth [hObject1] := 100;
RasterAnn.AnnRectHeight [hObject1] := 100;
RasterAnn.AnnCreate (ANN_OBJECT_NOTE, True, True);
hObject2:= RasterAnn.AnnObject;
RasterAnn.AnnRectLeft [hObject2] := 0;
RasterAnn.AnnRectTop[hObject2] := 100;
RasterAnn.AnnRectWidth[hObject2] := 100;
RasterAnn.AnnRectHeight[hObject2] := 100;
//Re-enable the undo feature
RasterAnn.AnnUndoEnable := True;
end;