Displaying Custom Expanders

Regular expanders are displayed in the table by default:

Custom expanders can be set up in the development environment in the Fore language using the ITabSheet.ExpanderOnPicture and ITabSheet.ExpanderOffPicture properties.

To display custom expanders:

  1. Select icon storage option:

  2. Execute the unit depending on the selected icon storage option:

Sub UserProc;
Var
    MB: IMetabase;
    Rep: IPrxReport;
    SheetT: IPrxTable;
    Tab: ITabSheet;
    TImg: ITabImages;
    ExpOn, ExpOff: Integer;
    Res: IResourceObject;
Begin
    // Get repository
    MB := MetabaseClass.Active;
    // Get regular report
    Rep := MB.ItemById("REP_ID").Edit As IPrxReport;
    // Get table from report sheet
    SheetT := Rep.ActiveSheet As IPrxTable;
    Tab := SheetT.TabSheet;
    // Get custom expander image from resources
    Res := MetabaseClass.Active.ItemById("RES_ID").Bind As IResourceObject;
    TImg := Tab.Images;
    // Clear collection of images
    TImg.RemoveAll(True);
    // Get image for expanded expander from resource
    ExpOn := TImg.Add(GxImage.FromStream(Res.Binaries.Value("ID_EXPOn")));
    // Get image for collapsed expander from resource
    ExpOff := TImg.Add(GxImage.FromStream(Res.Binaries.Value("ID_EXPOff")));
    // Set custom expanders
    Tab.ExpanderOnPicture := ExpOn;
    Tab.ExpanderOffPicture := ExpOff;
    (Rep As IMetabaseObject).Save;
End Sub UserProc;

Sub UserProc;
Var
    MB: IMetabase;
    Rep: IPrxReport;
    SheetT: IPrxTable;
    Tab: ITabSheet;
    TImg: ITabImages;
    ExpOn, ExpOff: Integer;
    Res: IResourceObject;
Begin
    // Get repository
    MB := MetabaseClass.Active;
    // Get regular report
    Rep := MB.ItemById("REP_ID").Edit As IPrxReport;
    // Get table from report sheet
    SheetT := Rep.ActiveSheet As IPrxTable;
    Tab := SheetT.TabSheet;
    // Get collection of table area images
    TImg := Tab.Images;
    // Clear collection of images
    TImg.RemoveAll(True);
    // Get image for expanded expander from the file system
    ExpOn := TImg.Add(GxImage.FromFile("С:\On.png"));
    // Get image for collapsed expander from the file system
    ExpOff := TImg.Add(GxImage.FromFile("C:\Off.png"));
    // Set custom expanders
    Tab.ExpanderOnPicture := ExpOn;
    Tab.ExpanderOffPicture := ExpOff;
    (Rep As IMetabaseObject).Save;
End Sub UserProc;

After executing the operations, custom expanders are displayed:

See also:

Dimension Elements Layout