AnnLock example for C++ Builder
//This example locks objects of type ANNOBJECT_ELLIPSE using the key "LEADTOOLS".
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int nType;
int a;
bool bSelected;
int uCount;
L_PHANDLE phObjects; //pointer to the array of the selected object handles
//lock only the ellipse objects that are selected
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
for (a= 1; a <= uCount; a ++)
{
nType= LEADAnn1->AnnGetType (LEADAnn1->AnnGetItemHandle (phObjects, a - 1));
if ( nType == ANNOBJECT_ELLIPSE ) //Is the object a polygon?
{
bSelected= true;
LEADAnn1->AnnLock (LEADAnn1->AnnGetItemHandle (phObjects, a - 1), "LEADTOOLS", false);
}
}
if (!bSelected )
ShowMessage ("No Ellipse Objects were selected");
if (phObjects)
{
free (phObjects);
}
}
}