AnnGetGrouping example for C++ Builder

//This example will toggle the grouping feature for all
//the sub-containers

//This event is fired for each annotation
//Toggles the Grouping feature for all the containers
void __fastcall TForm1::LEADAnn1AnnEnumerate (L_HANDLE hObject)
{
if ( LEADAnn1->AnnGetType (hObject)== ANNOBJECT_CONTAINER )
     LEADAnn1->AnnSetGrouping (hObject,
                 ! LEADAnn1->AnnGetGrouping (hObject),0) ;
}

//Add sub-containers by selecting objects and grouping them
//before clicking on this button
//Note that after you disable the grouping you can select and change
//individual objects belonging to a group. When you re-enable
//the grouping, the objects act as a group again.
void __fastcall TForm1::Button1Click(TObject *Sender)
{
   LEADAnn1->AnnUserMode = ANNUSERMODE_DESIGN;
   LEADAnn1->AnnEnumerate (LEADAnn1->AnnContainer, ANNFLAG_RECURSE + ANNFLAG_NOTTHIS, NULL);
}