Difference between revisions of "SetClient"

From SCAR Divi Manual
Jump to: navigation, search
(Created page with "==Definition== <source lang="scar" lines="false"> function SetClient(const Client: TSCARClient): TSCARClient; </source> ==Availability== SCAR Divi 3.35 > Current ==Descripti...")
 
 
Line 8: Line 8:
  
 
==Description==
 
==Description==
Sets a given [[TSCARClient]] '''Client''' as the currently active target client for the script's execution. The previously active client is returned.
+
Sets a given [[TSCARClient]] '''Client''' as the currently active target client for the script's execution. The previously active client object is returned.
  
 
==Example==
 
==Example==
Line 14: Line 14:
 
begin
 
begin
 
   SetClient(TSCARWindowClient.Create(GetDesktopWindow)).Free;
 
   SetClient(TSCARWindowClient.Create(GetDesktopWindow)).Free;
 +
end.
 +
</source>
 +
 +
==Example (Return Value)==
 +
<source lang="scar">
 +
var
 +
  Client, NewClient, StoredClient: TSCARClient;
 +
 +
begin                 
 +
  ClearDebug;
 +
                         
 +
  Client := GetClient;
 +
  NewClient := TSCARWindowClient.Create(GetDesktopWindow);
 +
 +
  StoredClient := SetClient(NewClient);
 +
  WriteLn(StoredClient = Client); 
 +
  WriteLn(StoredClient = NewClient); 
 +
 
 +
  StoredClient := SetClient(Client);
 +
  WriteLn(StoredClient = Client); 
 +
  WriteLn(StoredClient = NewClient);
 
end.
 
end.
 
</source>
 
</source>

Latest revision as of 09:49, 8 August 2012

Definition

function SetClient(const Client: TSCARClient): TSCARClient;

Availability

SCAR Divi 3.35 > Current

Description

Sets a given TSCARClient Client as the currently active target client for the script's execution. The previously active client object is returned.

Example

begin
  SetClient(TSCARWindowClient.Create(GetDesktopWindow)).Free;
end.

Example (Return Value)

var
  Client, NewClient, StoredClient: TSCARClient;

begin                   
  ClearDebug;
                          
  Client := GetClient;
  NewClient := TSCARWindowClient.Create(GetDesktopWindow);
 
  StoredClient := SetClient(NewClient); 
  WriteLn(StoredClient = Client);  
  WriteLn(StoredClient = NewClient);   
   
  StoredClient := SetClient(Client); 
  WriteLn(StoredClient = Client);  
  WriteLn(StoredClient = NewClient);
end.

See Also