AnnGetAutoMenuItemEnable example for Delphi
var
//Global declarations
RasterAnn: LEADRasterAnnotation;
RasterAnnToolbar: LEADRasterAnnToolBar;
hGlobalAnn: Integer;
//Note that hGlobalAnn should be a valid value before clicking Button2.
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
iEnable: AnnMenuConstants;
begin
//This example disables the "delete" menu item from the annotation hGlobalAnn.
RasterAnn.AnnSetAutoMenuItemEnable (hGlobalAnn, ANN_OBJECT_CONTAINER, ANN_AUTOTEXT_MENU_DELETE, ANN_MENU_DISABLED, ANN_FLAG_RECURSE + ANN_FLAG_SELECTED, '');
RasterAnn.AnnGetAutoMenuItemEnable (hGlobalAnn, ANN_OBJECT_CONTAINER, ANN_AUTOTEXT_MENU_DELETE);
iEnable:= RasterAnn.AnnAutoMenuItemEnable;
Case (iEnable) of
ANN_MENU_ENABLED:
ShowMessage ('ANN_MENU_ENABLED');
ANN_MENU_DISABLED:
ShowMessage ('ANN_MENU_DISABLED');
ANN_MENU_DEFAULT:
ShowMessage ('ANN_MENU_DEFAULT');
end;
end;