AnnLock example for Delphi
This example locks objects of type ANNOBJECT_ELLIPSE using the key "LEADTOOLS".
procedure TForm1.Button1Click(Sender: TObject);
var
nType:Integer;
a: Integer;
bSelected: Boolean;
uCount: Integer;
phObjects: L_PHANDLE; //pointer to the array of the selected object handles
begin
//lock only the ellipse objects that are selected
bSelected:= False;
uCount:= LEADAnn1.AnnGetSelectCount (); //get number of selected objects
if ( uCount > 0 ) then
begin
phObjects:= AllocMem (uCount * sizeof (L_HANDLE)) ;
if (phObjects= Nil ) then
begin
ShowMessage ('NO Memory') ;
Exit;
end;
LEADAnn1.AnnGetSelectList (phObjects); //get the handles of the selected objects
for a:= 1 to uCount do
begin
nType:= LEADAnn1.AnnGetType (LEADAnn1.AnnGetItemHandle ( phObjects, a - 1));
if ( nType = ANNOBJECT_ELLIPSE ) then //Is the object a polygon?
Begin
bSelected:= True;
LEADAnn1.AnnLock ( LEADAnn1.AnnGetItemHandle ( phObjects, a - 1 ), 'LEADTOOLS', False );
end;
end;
if (bSelected = False ) then
ShowMessage ( 'No Ellipse Objects were selected' ) ;
if ( phObjects <> Nil ) then
begin
FreeMem (phObjects);
end;
end;
end;