ButtonVisible 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;
pRasterAnnToolbar->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();
}
void ToggleVisibleState(LEADRasterAnnToolBar* pAnnToolBar, short iButtonIndex)
{
if (pAnnToolBar->get_ButtonVisible(iButtonIndex))
{
pAnnToolBar->set_ButtonVisible (iButtonIndex, false);
ShowMessage ("Button Index " + IntToStr(iButtonIndex) + " visible state is False");
}
else
{
pAnnToolBar->set_ButtonVisible(iButtonIndex, true);
ShowMessage ("Button Index " + IntToStr(iButtonIndex) + " visible state is True");
}
}