TParamRecord Example

The following program code demonstrates how you can use a TParamRecord variable to save a copy of a single parameter of a TRPCBroker component. This example assumes that prior to calling this procedure, a TRPCBroker variable has been created and some parameters have been set up. Pay close attention to how properties are copied one at a time. This is the only way that a separate copy could be created. If you try to simply assign one of the TRPCBroker parameters to the TParamRecord variable, you’ll simply re-point the TParamRecord variable to that parameter:

procedure TForm1.Button1Click(Sender: TObject);
var
  ParamRecord: TParamRecord;
begin
  ParamRecord := TParamRecord.Create(Form1);  {Create ParamRecord. Make Form1 its owner}
  ParamRecord.Value := RPCBroker.Param[0].Value;  {Store properties one at a time}
  ParamRecord.PType := RPCBroker.Param[0].PType;
  ParamRecord.Mult.Assign(RPCBroker.Param[0].Mult);  {This is how to copy a Mult }
end;