AnnGetGrouping example for C++ Builder
//Global declarations
LEADRasterAnnotation * pRasterAnn= NULL;
LEADRasterAnnToolBar* pRasterAnnToolbar= NULL;
void __fastcall TForm1::Button1Click(TObject *Sender)
{
CoCreateInstance(CLSID_LEADRasterAnnotation, NULL, CLSCTX_ALL, IID_ILEADRasterAnnotation, (void**)&pRasterAnn);
CoCreateInstance(CLSID_LEADRasterAnnToolBar, NULL, CLSCTX_ALL, IID_ILEADRasterAnnToolBar, (void**)&pRasterAnnToolbar);
pRasterAnn->AnnParentRasterView = LEADRasterView1->Raster;
LEADEventSink1->Connect (pRasterAnn, DIID__LEADRasterAnnotationEvents);
pRasterAnn->AnnUserMode = ANN_USERMODE_DESIGN ;
}
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
if (pRasterAnn)
pRasterAnn->Release ();
if (pRasterAnnToolbar)
pRasterAnnToolbar-> Release();
}
/*This example toggles the 'group' state of all objects in the main container*/
void __fastcall TForm1::Button2Click(TObject *Sender)
{
bool bGroup;
//Get current group state
bGroup= pRasterAnn->AnnGetGrouping (pRasterAnn->AnnContainer);
//Toggle the group state
pRasterAnn->AnnSetGrouping (pRasterAnn->AnnContainer, !bGroup, 0);
//Display the group state
if (pRasterAnn->AnnGetGrouping(pRasterAnn->AnnContainer))
ShowMessage ("Objects in AnnContainer are grouped");
else
ShowMessage ("Objects in AnnContainer are not grouped");
}