AnnGetSelectList example for C++ Builder
//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.
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int nType;
int a;
bool bSelected;
AnsiString Msg;
int uCount;
L_PHANDLE phObjects; //array for the selected object handles
bSelected= false;
uCount= LEADAnn1->AnnGetSelectCount (); //get number of selected objects
if ( uCount > 0 )
{
phObjects= ( L_PHANDLE ) malloc ( uCount * sizeof ( L_HANDLE )) ;
if (!phObjects )
{
ShowMessage ("NO Memory") ;
return;
}
LEADAnn1->AnnGetSelectList(phObjects); //get the handles of the selected objects
Msg= IntToStr(uCount) + " objects were selected";
ShowMessage (Msg);
for ( a = 1; a<= uCount; a ++ )
{
nType= LEADAnn1->AnnGetType (LEADAnn1->AnnGetItemHandle ( phObjects, a - 1));
if ( nType == ANNOBJECT_POLYGON ) //Is the object a polygon?
bSelected= true;
}
if (!bSelected)
ShowMessage ("No Polygon Objects were selected");
if (phObjects)
{
free (phObjects);
}
}
else
ShowMessage ( "No Selected Objects" ) ;
}