Value: Variant;
The Value property determines a constant value sent to parameter of opened object.
The set value should have the same data type as the opened object parameter.
Executing the example requires that the repository contains two regular reports with the REPORT and REPORT_ADD identifiers.
The file system should contain the button image file D:\Work\Image\btn16x16.png.
Add links to the IO, Metabase, and Report system assemblies.
Sub UserProc;
Var
Mb: IMetabase;
Report: IPrxReport;
UserBtn: IPrxUserButton;
OpenObjAction: IPrxUserButtonActionOpenObject;
ObjParam: IPrxOpenObjectParam;
Sheets: Array Of Integer;
Begin
Mb := MetabaseClass.Active;
Report := Mb.ItemById("REPORT").Edit As IPrxReport;
// Create a new custom button
UserBtn := Report.UserButtons.AddByType(PrxUserButtonType.OpenObject);
UserBtn.Name := "Open object";
// Set up custom button
UserBtn.Icon := New FileStream.Create("d:\Work\Image\btn16x16.png", FileOpenMode.Read, FileShare.DenyNone);
UserBtn.IconType := "png";
UserBtn.SmallIcon := False;
// Set up actions
OpenObjAction := UserBtn.Action As IPrxUserButtonActionOpenObject;
OpenObjAction.ObjectForOpen := Mb.ItemById("REPORT_ADD");
OpenObjAction.OpenInModal := True;
Sheets := New Integer[1];
Sheets[0] := 1;
OpenObjAction.SheetsForRefresh := Sheets;
ObjParam := OpenObjAction.Params.Item(0);
ObjParam.Type := PrxOpenObjectParamType.Constant;
(ObjParam.Control As IPrxOpenObjectConstantParamControl).Value := 100;
// Save changes
(Report As IMetabaseObject).Save;
End Sub UserProc;
After executing the example a new custom button is created in the REPORT regular report. Name, image, and list of updated sheets will be set for the button. Object opening will be selected as a custom button action. A constant value will be sent to the opened object parameter.
See also: