AnnGetSelectList example for Delphi
//This example is also for:
// AnnGetSelectCount method,
//This example gets the number of selected annotation objects; then it gets an array of the
//selected object handles and checks to see if any of the objects in the array are polygons.
procedure TForm1.Button1Click(Sender: TObject);
var
nType: Integer;
a: Integer;
bSelected: Boolean;
Msg: String;
uCount: Integer;
phObjects: L_PHANDLE; //array for the selected object handles
begin
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
Msg:= IntToStr(uCount) + ' objects were selected';
ShowMessage (Msg);
for a:= 1 to uCount do
begin
nType:= LEADAnn1.AnnGetType (LEADAnn1.AnnGetItemHandle ( phObjects, a - 1));
if ( nType = ANNOBJECT_POLYGON ) then //Is the object a polygon?
bSelected:= True;
end;
if (bSelected = False ) then
ShowMessage ( 'No Polygon Objects were selected' ) ;
if ( phObjects <> Nil ) then
begin
FreeMem (phObjects);
end;
end
else
ShowMessage ( 'No Selected Objects' ) ;
end;