AnnGetObjectFromTag example for Delphi
//This example retrieves the annotation handle for tag no. 1
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;
procedure TForm1.Button2Click(Sender: TObject);
var
hTagObject: Integer;
lTag: Longint;
begin
ShowMessage ('I Will Looking For an Object With Tag = 1');
RasterAnn.AnnGetObjectFromTag (RasterAnn.AnnContainer, 1, False);
hTagObject:= RasterAnn.AnnTagObject;
RasterAnn.AnnGetTag (hTagObject);
lTag:= RasterAnn.AnnTag;
if (lTag= 1) then
ShowMessage ('Annotation Found with tag 1: ' + IntToHex(hTagObject, 6))
else
ShowMessage ('Annotation NOT found with tag 1 ');
end;