Icon: IIOStream;
The Icon property determines a stream with an image that will be displayed for a group of buttons.
To execute the example the repository must contain a regular report with the REPORT identifier. The file system should contain the image for a group of buttons: D:\Work\Image\group16x16.png.
Add links to the IO, Metabase, and Report system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
Report: IPrxReport;
Toolbar: IPrxToolbar;
Elements: IPrxToolbarElements;
Element: IPrxToolbarElement;
Group: IPrxUserGroupElement;
Begin
Mb := MetabaseClass.Active;
// Get regular report
Report := Mb.ItemById("REPORT").Edit As IPrxReport;
// Get toolbar
Toolbar := Report.Toolbar;
// Create a separator and a custom group of buttons
Elements := Toolbar.Elements;
Elements.Add(PrxToolbarAddElementType.Separator);
Element := Elements.Add(PrxToolbarAddElementType.UserGroup);
Element.Name := "Custom group of buttons";
Group := Element As IPrxUserGroupElement;
Group.Icon := New FileStream.Create("D:\Work\Image\group16x16.png", FileOpenMode.Read, FileShare.DenyNone);
Group.IconType := "png";
// Save changes
Report.MetabaseObject.Save;
End Sub UserProc;
After executing the example a group of custom buttons is created in the specified regular report toolbar. Name and icon are determined for the group.
See also: