AnnGetGrouping example for Delphi
//This example toggles the 'group' state of all objects in the main container
var
//Global declarations
RasterAnn: LEADRasterAnnotation;
RasterAnnToolbar: LEADRasterAnnToolBar;
procedure TForm1.Button1Click(Sender: TObject);
begin
RasterAnn:= CoLEADRasterAnnotation.Create ();
RasterAnnToolbar:= CoLEADRasterAnnToolBar.Create ();
RasterAnn.AnnParentRasterView := LEADRasterView1.Raster;
LEADEventSink1.Connect (RasterAnn, _LEADRasterAnnotationEvents);
RasterAnn.AnnUserMode:= ANN_USERMODE_DESIGN;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
bGroup: Boolean;
begin
//Get current group state
bGroup:= RasterAnn.AnnGetGrouping (RasterAnn.AnnContainer);
//Toggle the group state
RasterAnn.AnnSetGrouping (RasterAnn.AnnContainer, Not bGroup, 0);
//Display the group state
if (RasterAnn.AnnGetGrouping(RasterAnn.AnnContainer)) then
ShowMessage ('Objects in AnnContainer are grouped')
else
ShowMessage ('Objects in AnnContainer are not grouped');
end;