Difference between revisions of "RPC HELP TParams Assign Example"

From VistApedia
Jump to: navigation, search
(Created page with "Assign Example (TParams Class) The following program code demonstrates how a TParams assign method can be used to save off the TRPCB c...")
 
 
Line 1: Line 1:
Assign Example (TParams Class)
+
<h2>Assign Example (TParams Class)</h2>
The following program code demonstrates how a [[RPC_HELP_TParams|TParams]] assign method can be used to save off the [[RPC_HELP_TRPCB|TRPCB]] component parameters and restore them later:
+
The following program code demonstrates how a [[RPC_HELP_TParams|TParams]] assign method can be used to save off the [[RPC_HELP_TRPCB|TRPCB]] component parameters and restore them later:
 
 
  
     procedure TForm1.Button1Click(Sender: TObject);
+
     '''procedure''' TForm1.Button1Click(Sender: TObject);
     var
+
     '''var'''
 
       SaveParams: TParams;
 
       SaveParams: TParams;
 
       SaveRemoteProcedure: string;
 
       SaveRemoteProcedure: string;
     begin
+
     '''begin'''
 
       {create holding variable with Form1 as owner}
 
       {create holding variable with Form1 as owner}
 
       SaveParams := TParams.Create(self);
 
       SaveParams := TParams.Create(self);
Line 21: Line 21:
 
       {release memory}
 
       {release memory}
 
       SaveParams.Free;
 
       SaveParams.Free;
     end;
+
     '''end;'''

Latest revision as of 01:26, 4 July 2015

Assign Example (TParams Class)

The following program code demonstrates how a TParams assign method can be used to save off the TRPCB component parameters and restore them later:


   procedure TForm1.Button1Click(Sender: TObject);
   var
     SaveParams: TParams;
     SaveRemoteProcedure: string;
   begin
     {create holding variable with Form1 as owner}
     SaveParams := TParams.Create(self);
     {save parameters}
     SaveParams.Assign(brkrRPCBroker1.Param);
     SaveRemoteProcedure := brkrRPCBroker1.RemoteProcedure;
     brkrRPCBroker1.RemoteProcedure := 'SOME OTHER PROCEDURE';
     brkrRPCBroker1.ClearParameters := True;
     brkrRPCBroker1.Call;
     {restore parameters}
     brkrRPCBroker1.Param.Assign(SaveParams);
     brkrRPCBroker1.RemoteProcedure := SaveRemoteProcedure;
     {release memory}
     SaveParams.Free;
   end;