IClient interface

IClient Interface

Overview 
The IClient interface (from EDPInterfaces unit) represents the shell or subsystem of the Altium Designer application and the Client object manages the commands (pre packaged process launchers), process depths and documents amongst many other objects. A plug-in module loaded in Altium Designer has hooks to the single executable subsystem, so you have access to the specific documents and launch commands on these documents.

The IClient interface and its sub interfaces;

• ICommandLauncher (deals with process launchers)
• IProcessLauncher (deals with launching a process)
• IServerDocumentView (deals with panels or documents)
• IProcessControl (determines the level of stacked processes)
• IGUIManager (deals with the User interface of Altium Designer, the locations and state of panels)
• IServerModule (deals with loaded servers in ALlium Designer)
• INotification (broadcast or dispatch notification messages to servers or to a specified plug-in)

You can obtain the IClient interface object by calling the Client function (from the EDPClasses unit part of the Altium Designer SDK).


IClient Methods and Properties Table

IClient methods 
AddServerView
AddViewToFavorites
ApplicationIdle
BeginDisableInterface
BeginDocumentLoad
BeginRecoverySave
BroadcastNotification
CanServerStarted
CloseDocument
DispatchNotification
EndDisableInterface
EndDocumentLoad
EndRecoverySave
GetApplicationHandle
GetCommandLauncher
GetCount
GetCurrentView
GetDefaultExtensionForDocumentKind
GetDocumentByPath
GetDocumentKindFromDocumentPath
GetDynamicHelpManager
GetEncryptedTechnologySets
GetGUIManager
GetMainWindowHandle
GetNavigationSystem
GetOptionsSet
GetOptionsSetByName
GetOptionsSetCount
GetPanelInfoByName
GetProcessControl
GetRealMainWindowHandle
GetServerModule
GetServerModuleByName
GetServerNameByPLID
GetServerRecord
GetServerRecordByName
GetServerRecordCount
GetServerViewFromName
GetTimerManager
GetWindowKindByName
HideDocument
InRecoverySave
IsDocumentOpen
IsQuitting
LastActiveDocumentOfType
LicenseInfoStillValid
OpenDocument
OpenDocumentShowOrHide
QuerySystemFont
RegisterNotificationHandler
RemoveServerView
SetCurrentView
ShowDocument
ShowDocumentDontFocus
StartServer
StopServer
UnregisterNotificationHandler

IClient Properties 
ApplicationHandle
CommandLauncher
Count
CurrentView
GUIManager
MainWindowHandle
NavigationSystem
ProcessControl
ServerModule
ServerModuleByName
TimerManager

IClient Methods

AddServerView method

(IClient interface)
Syntax 
Procedure AddServerView (AView : IServerView);
Description 
This procedure adds a document view such as a custom panel in the Client object within Altium Designer. In the TServerModule constructor, where the server commands are registered, this is the place to create global panel views. The TServerModule.CreateServerViews method will have the global panel form and the view created from this panel form. Then the view is added to the server module (TServerModule.AddView()) as well as in the client object (Client.AddServerView).
See also 
IServerView interface
IClient interface
RT_ServerImplementation for the TServerModule class.

ApplicationIdle method

(IClient interface)
Syntax 
Procedure ApplicationIdle;
Description 
When the ApplicationIdle method is invoked, the procedure puts the Altium Designer in a mode where it has a chance to process Window and Altium Designer specific messages.
See also 
IClient interface

BeginDisableInterface method

(IClient interface)
Syntax 
Procedure BeginDisableInterface;
Description 
These BeginDisableInterface and EndDisableInterface methods are invoked when the User Interface of Client need to be disabled, for example there might be extensive processing going on, and you do not want the user's intervention.
See also 
EndDisableInterface method
IClient interface

BeginDocumentLoad method

(IClient interface)
Syntax 
Procedure BeginDocumentLoad;
Description 
The BeginDocumentLoad and EndDocumentLoad procedures are used to load a group of documents in Altium Designer.
Example

 

Client.BeginDocumentLoad;
ServerDocument1  :=  Client.OpenDocument('Text',FileName1);
ServerDocument2  :=  Client.OpenDocument('Text',FileName2);
ServerDocument3  :=  Client.OpenDocument('Text',FileName3);
Client.EndDocumentLoad(True);

 

See also 
EndDocumentLoad method
IClient interface

BeginRecoverySave method

(IClient interface)
Syntax 
Procedure BeginRecoverySave;
Description 
The BeginRecoverySave and EndRecoverySave properties can be used to suppress the client notification of document name changes when doing a backup of a current design document in Altium Designer. To check if the recovery save process is in progress, invoke the InRecoverySave method.
See also 
EndRecoverySave method
InRecoverySave method
IClient interface

BroadcastNotification method

(IClient interface)
Syntax 
Procedure BroadcastNotification (ANotification : INotification);
Description 
This procedure broadcasts a notification message in Altium Designer where all active design documents / servers have an opportunity to respond. A BoardcastNotification is a DispatchNotification (Nil, ANotification); There are five types of Notification interfaces; ISystemNotification, IDocumentNotification, IDocumentFormNotification, IViewNotification and IModuleNotification.
See also 
DispatchNotifiaction method
INotification interface
IClient interface

Client_CanServerStarted method

(IClient interface)
Syntax 
Function CanServerStarted (AModuleName : PChar) : LongBool; 
Description 
This function checks if a server module can be loaded in Altium Designer. Use this before invoking the StartServer function.
See also 
IClient interface
StartServer method

CloseDocument method

(IClient interface)
Syntax 
Procedure CloseDocument(ADocument : IServerDocument);
Description 
This procedure fetches the IServerDocument parameter to close the specified document (if it is loaded and opened in Altium Designer already). Note the document is not removed from Altium Designer, that is, the document still exists on the Projects panel for example.
See also 
OpenDocument method
IClient interface

Count property

(IClient interface)
Syntax 
Property Count : Integer Read GetCount;
Description 
This property returns the number of active servers in a current session of Altium Designer. Use this property in conjunction with the ServerModule property to fetch Server Module interfaces.
See also 
GetCount method
IServerModule interface
IClient interface

DispatchNotification method

(IClient interface)
Syntax 
Procedure DispatchNotification (AServerModule : IServerModule; ANotification : INotification); 
Description 
This procedure dispatches a notification message to the targeted server in Altium Designer. There are four types of Notification interfaces; IDocumentNotification, IDocumentFormNotification, IViewNotification and IModuleNotification.
See also 
INotification interface
IClient interface

EndDisableInterface method

(IClient interface)
Syntax 
Procedure EndDisableInterface;
Description 
These BeginDisableInterface and EndDisableInterface methods are invoked when the User Interface of Client needs to be disabled, for example there might be extensive
processing going on, and you do not want the user's intervention. This is a Altium Designer wide method.
See also 
BeginDisableInterface method
IClient interface

EndDocumentLoad method

(IClient interface)
Syntax 
Procedure EndDocumentLoad(AShow : LongBool);
Description 
The BeginDocumentLoad and EndDocumentLoad procedures are used to load a group of documents in Altium Designer.
Example

 

Client.BeginDocumentLoad;
ServerDocument1  :=  Client.OpenDocument('Text',FileName1);
ServerDocument2  :=  Client.OpenDocument('Text',FileName2);
ServerDocument3  :=  Client.OpenDocument('Text',FileName3);
Client.EndDocumentLoad(True);

 

See also 
IClient interface
BeginDocumentLoad method

EndRecoverySave method

(IClient interface)
Syntax 
Procedure EndRecoverySave;
Description 
The BeginRecoverySave and EndRecoverySave methods can be used to suppress the client notification of document name changes when doing a backup of a current design document in Altium Designer.
To check if the recovery save is in progress, invoke the InRecoverySave method.
See also 
BeginRecoverySave method
InRecoverySave method
IClient interface

GetApplicationHandle method

(IClient interface)
Syntax 
Function GetApplicationHandle : Integer;
Description 
You can use the application handle into server code if dialogs need to be created dynamically from your server and so that when a dialog that appears on Altium Designer will inherit Altium Designer's icon and appear as one whole application on the task bar. 
This ApplicationHandle property can be passed as a parameter for the create constructor of the dialog. The GetMainWindowHandle function is its equivalent.
See also 
GetMainWindowHandle method
ApplicationHandle property
IClient interface

GetCommandLauncher method

(IClient interface)
Syntax 
Function GetCommandLauncher : ICommandLauncher;
Description 
This function fetches the ICommandLauncher interface which represents Client's process launcher which can be used to launch a server process and its parameters. See the IProcessLauncher interface as well.
See also 
ICommandLauncher interface
IProcessLauncher interface
IClient interface

GetCount method

(IClient interface)
Syntax 
Function GetCount : Integer;
Description 
This method returns the number of active (loaded) servers in a current session of Altium Designer. Use this method (or the Count property) in conjunction with the ServerModule property to fetch Server Module interfaces.
See also 
Count property
IClient interface

GetCurrentView method

(IClient interface)
Syntax 
Function GetCurrentView : IServerDocumentView;
Description 
This function fetches the current view (ie the open document in focus in Altium Designer). See the CurrentView property and the IServerDocumentView interface.
Example

 

Procedure  GrabACurrentDocumentView;
Var 
  ServerDocumentView  :  IServerDocumentView;
  CurrentDirectory  :  AnsiString;
Begin
  ServerDocumentView  :=  Client.GetCurrentView;
  CurrentDirectory  :=  ExtractFileDir(ServerDocumentView.GetOwnerDocument.FileName);
End;

 

See also 
CurrentView property
IClient interface

GetDefaultExtensionForDocumentKind method

(IClient interface)
Syntax 
Function GetDefaultExtensionForDocumentKind(DocumentKind : PChar) : PChar; 
Description 
This function returns the default extension for the specific document kind based on the document kind parameter.
IClient interface

GetDocumentByPath method

(IClient interface)
Syntax 
Function GetDocumentByPath(Const AFilePath : WideString) : IServerDocument;
Description 
This function fetches the full file path to a design document and if the path is valid, an IServerDocument object interface is returned representing the whole design document and its panels.
See also 
IClient interface

GetDocumentKindFromDocumentPath method

(IClient interface)
Syntax 
Function GetDocumentKindFromDocumentPath (Path : PChar) : PChar; 
Description 
This function returns the document kind based on the valid and full document path.
See also 
IClient interface

GetEncryptedTechnologySets method

(IClient interface)
Syntax 
Function GetEncryptedTechnologySets (Var ValidAtTimestamp : Cardinal) : WideString;
Description

Example

See also 
IClient interface

GetGUIManager method

(IClient interface)
Syntax 
Function GetGUIManager : IGUIManager;
Description 
Returns the GUI Manager interface. Use the GUIManager property instead. This Interface object deals with the User Interface of Altium Designer such as controlling the status bars of Altium Designer, the locations and the state of panels in Altium Designer.
See also 
IGUIManager interface
IClient interface

GetLicenseManager function

(IClient interface)
Syntax 
Function GetLicenseManager : ILicenseManager;
Description

Example

See also 
IClient interface
ILicenseManager interface

GetMainWindowHandle method

(IClient interface)
Syntax 
Function GetMainWindowHandle : Integer;
Description 
You can use the application handle into server code if dialogs need to be created dynamically from your server and so that when a dialog that appears on Altium Designer will inherit Altium Designer's icon and appear as one whole application on the task bar. This ApplicationHandle property is also its equivalent.
See also 
GetApplicationHandle method
ApplicationHandle property
IClient interface

GetNavigationSystem method

(IClient interface)
Syntax 
Function GetNavigationSystem : INavigationSystem; 
Description 
The function returns the Navigation system interface.
See also 
INavigationSystem interface
IClient interface

GetOptionsManager function

(IClient interface)
Syntax 
Function GetOptionsManager : IOptionsManager;
Description 
This method retrieves the IOptionsManager interface. With this interface, you can invoke the GetOptionsReader or GetOptionsWriter to retrieve or write options (settings) for the target server. Each editor server has options that manage its server documents.
Example 
Var
Reader : IOptionsReader;
Begin
Reader := Client.OptionsManager.GetOptionsReader(NameOfServer,'');
If Reader = Nil Then Exit;

AValue := Reader.ReadBoolean(NameOfServerPreferences,SettingName,DefaultValue);
End;
See also 
IClient interface
IOptionsManager

GetOptionsSetByName method

(IClient interface)
Syntax 
Function GetOptionsSetByName (Const AName : Widestring) : IDocumentOptionsSet;
Description 
This function retrieves the IDocumentOptionsSet interface based on the valid Name string.
See also 
GetOptionsSetCount method
GetOptionsSet method
IDocumentOptionsSet interface
IClient interface

GetOptionsSetCount method

(IClient interface)
Syntax 
Function GetOptionsSetCount : Integer;
Description 
This function returns you the number of Options Set.
See also 
GetOptionsSet method
GetOptionsSetByName method
IClient interface

GetOptionsSet method

(IClient interface)
Syntax 
Function GetOptionsSet (Index : Integer) : IDocumentOptionsSet;
Description 
This function returns you the indexed Options set (IDocumentOptionsSet type).
See also 
GetOptionsSetCount method
GetOptionsSetByName method
IClient interface

GetPanelInfoByName method

(IClient interface)
Syntax 
Function GetPanelInfoByName (Const APanelName : Widestring)
: IServerPanelInfo;
Description 
This function obtains the IServerPanelInfo interface for the specified panel.
See also 
IServerPanelInfo interface
IClient interface

GetProcessControl method

(IClient interface)
Syntax 
Function GetProcessControl : IProcessControl;
Description 
Returns the Process Control interface. This Process Control determines the number of "re-entrant" processes occurring, ie one client's process occurring stacked on top of another active client's process - this is the process depth. If a process control's process depth is zero, it indicates that nothing is taking place in Altium Designer.
See also 
IProcessControl interface
IClient interface

GetRealMainWindowHandle method

(IClient interface)
Syntax 
Function GetRealMainWindowHandle : THandle;
Description 
The function returns the window handle of the main window in Altium Designer.
See also 
IClient interface

GetServerNameByPLID method

(IClient interface)
Syntax 
Function GetServerNameByPLID(APLID : PChar) : PChar; 
Description 
This function returns you the server name based on the PLID identifier string (a string extracted from the server's resources file).
See also 
IClient interface

GetServerModule method

(IClient interface)
Syntax 
Function GetServerModule(Index : Integer) : IServerModule;
Description 
The ServerModule property is used in conjunction with the Count property to retrieve active (loaded) servers. The ServerModule property returns the IServerModule interface for the loaded server module in Altium Designer.
Note, that PCB server and Schematic server have their own IPCB_ServerInterface and ISch_ServerInterface interfaces respectively.
IServerModule example 
This example gets the Schematic's IServerModule interface and returns the number of document views open in Altium Designer

 

Var
  ServerModule  :  IServerModule;
Begin
  If  Client  =  Nil  Then  Exit;
 
  ServerModule  :=  Client.ServerModuleByName('SCH');
  ShowMessage('Doc  Count  =  '  +  IntToStr(ServerModule.DocumentCount));
End;

 

See also 
Count property
IServerModule property
ServerModuleByName property
IClient interface

GetServerModuleByName method

(IClient interface)
Syntax 
Function GetServerModuleByName (Const AModuleName : Widestring) : IServerModule;
Description 
The function returns the server module interface depending on the validity of the AModuleName parameter. Examples include 'PCB' or 'SCH'. Use the ServerModuleByName property instead to return the indexed server module.
Example

 

Var
  ServerModule  :  IServerModule;
Begin
  If  Client  =  Nil  Then  Exit;
 
  ServerModule  :=  Client.ServerModuleByName('SCH');
  ShowMessage('Doc  Count  =  '  +  IntToStr(ServerModule.DocumentCount));
End;

 

See also 
GetServerModule method
ServerModule property
IClient interface

GetServerRecord method

(IClient interface)
Syntax 
Function GetServerRecord (Index : Integer) : IServerRecord;
Description 
The GetServerRecord function reports the number of installed servers based on the installation *.INS files in the System folder of Altium Designer installation). Use this in conjunction with the GetServerRecordCount function.
The IClient interface has GetServerRecord and GetServerModule methods. The difference between these two methods is that the GetServerRecord function reports the number of installed servers (*.INS files in the \System\ folder of Altium Designer installation).
The GetServerModule merely returns the active (loaded) server in Altium Designer and to get each active server, you need to invoke the GetCount function and pass the count parameter into the GetServerModule function.
See also 
GetServerRecordCount method
GetServerModule method
IClient interface

GetServerRecordCount method

(IClient interface)
Syntax 
Function GetServerRecordCount : Integer;
Description 
This function returns the number of server records that represent the server installation files found in the \System\ folder of the Altium Designer software installation. This is to be used in conjunction with the GetServerRecord function.
See also 
IServerRecord interface
IClient interface

GetServerRecordByName method

(IClient interface)
Syntax 
Function GetServerRecordByName(AModuleName : WideString) : IServerRecord;
Description 
This function returns the IServerRecord interface based on the AModuleName parameter. This IServerRecord interface represents the installation file for the server (with an INS extension).
Example

 

Var
  ClientModule  :  IClient;
  ServerRecord  :  IServerRecord;
  Version  :  WideString;
Begin
  ClientModule  :=  Client;
  If  ClientModule  =  Nil  Then  Exit;
 
  //The  IServerRecord  interface  encapsulates  the  details
  //  of  a  server's  installation  file
 
  //We  are  interested  in  the Altium Designer's  Client  Module
  //  and  fetch  the  product  version.
  ServerRecord  :=  ClientModule.GetServerRecordByName('CLIENT');
  Version  :=  ServerRecord.GetVersion;
 
  ShowMessage(Version);
End;

 

See also 
IServerRecord interface

IClient interface

GetServerViewFromName method

(IClient interface)
Syntax 
Function GetServerViewFromName (Const ViewName : Widestring) : IServerView;
Description 
This function returns the server view object interface depending on the name of the server view. A IServerView interface represents a panel view as well as an ancestor for a document view.
See also 
IExternalForm interface
IServerView interface
IClient interface

GetTimerManager Interface

(IClient interface)
Syntax 
Function GetTimerManager : ITimerManager; 
Description 
This function returns the timer manager interface associated with the client sub system.
See also 
ITimerManager interface
IClient interface

GetWindowKindByName method

(IClient interface)
Syntax 
Function GetWindowKindByName (AWindowKindName : Widestring : IServerWindowKind
Description 
This function returns the IServerWindowKind interface based on the AWindowKindName parameter which denotes the document kind. For example, there are two document kinds in the PCB editor - PCB and PCBLIB documents.
See also 
IServerWindowKind interface
IClient interface

HideDocument method

(IClient interface)
Syntax 
Procedure HideDocument (Const ADocument : IServerDocument); 
Description 
This procedure hides the document, ie puts it out of focus but not closed or destroyed.
See also 
CloseDocument method
OpenDocument method
ShowDocument method
IServerDocument interface
IClient interface

OpenDocumentShowOrHide method

(IClient interface)
Syntax 
Function OpenDocumentShowOrHide (Const AKind, AFileName : WideString; AShowInTree : Boolean) : IServerDocument;
Description 
This function opens a specific document but you can control how it is displayed in the Altium Designer workspace.
See also 
IClient interface

HandleException method

(IClient interface)
Syntax 
Procedure HandleException (Const AMessage : WideString);
Description

Example

See also 
IClient interface

InRecoverySave method

(IClient interface)
Syntax 
Function InRecoverySave : LongBool 
Description 
This function checks whether Altium Designer is in the process of Recovery Save mode, before you can invoke the BeginRecoverySave or EndRecoverySave methods.
See also 
BeginRecoverySave method
EndRecoverySave method
IClient interface

IsDocumentOpen method

(IClient interface)
Syntax 
Function IsDocumentOpen (Const AFilePath : PChar) : LongBool; 
Description 
Returns a boolean value whether the document is open in Altium Designer or not and is dependent on whether the AFilePath parameter is valid or not.
See also 
IClient interface

IsQuitting method

(IClient interface)
Syntax 
Function IsQuitting : Boolean; 
Description 
Returns a boolean value that represents the state Altium Designer is in: True if Altium Designer is about to quit or in the process of quitting, False if Altium Designer is still active.
See also 
IClient interface

LastActiveDocumentOfType method

(IClient interface)
Syntax 
Function LastActiveDocumentOfType (Const AType : Widestring) : IServerDocument;
Description 
This function returns the last active loaded document in Altium Designer by the document type. Types include PCB, SCH, TEXT, WAVE, PCBLIB, SCHLIB.
See also 
IClient interface

IsInitialized function

(IClient interface)
Syntax 
Function IsInitialized : LongBool; 
Description

Example

See also 
Client interface

LicenseInfoStillValid method

(IClient interface)
Syntax 
Function LicenseInfoStillValid (Const RetrievedAt : Cardinal) : LongBool;
Description

See also 
IClient interface

MainWindowHandle property

(IClient interface)
Syntax 
Property MainWindowHandle : Integer Read GetMainWindowHandle;
Description 
The MainWindowHandle property returns the handle of the main window in Altium Designer which can be used for addon dialogs that will be attached to Altium Designer and have a single Altium Designer icon on the Taskbar for example.
See also 
GetMainWindowHandle method
ApplicationHandle property
IClient interface

OpenDocument method

(IClient interface)
Syntax 
Function OpenDocument (Const AKind, AFileName : PChar) : IServerDocument;
Description 
The OpenDocument method returns the IServerDocument interface depending on the DocumentKind and FileName values of this document are valid.
Example

 

Var
  ReportDocument  :  IServerDocument;
Begin
  ReportDocument  :=  Client.OpenDocument('Text',FileName);
  If  ReportDocument  <>  Nil  Then
  Client.ShowDocument(ReportDocument);
End

 

See also 
ShowDocument method
IClient interface

OpenNewDocument method

(IClient interface)
Syntax 
Function OpenNewDocument (Const AKind, AFileName, ANewName : Widestring; ReuseExisting : Boolean) : IServerDocument;
Description

Example

See also 
IClient interface

QuerySystemFont method

(IClient interface)
Syntax 
Procedure QuerySystemFont ( QueryMode : TFontQueryMode; 
Var AUseSysFont : Boolean;
Var AFontName : WideString;
Var AFontSize : Integer;
Var AFontStyle : TFontStyles;
Var AFontColor : TColor;
Var AFontCharset : TFontCharset);
Description 
Query the system font used.
See also 
IClient interface

RegisterNotificationHandler method

(IClient interface)
Syntax 
Procedure RegisterNotificationHandler(Const Handler : INotificationHandler); 
Description 
The RegisterNotificationHandler method registers the notification handler in the Client module part of Altium Designer once the server object is created and loaded in computer memory. The Handler parameter contains the server module object.
Notes 
The INotificationHandler object interface is responsible for handling notifications raised in Altium Designer.
Each server object has a HandleNotification procedure to handle notifications when the options values have been adjusted from the system wide Preferences dialog. 
The HandleNotification procedure would involve calls to update the server preferences values on the server panel for example every-time a specific server notification code is intercepted.
This method is normally used for in developing servers and not for scripts.
See also 
BroadcastNotification method
DispatchNotification method
UnRegisterNotificationHandler method
INotificationHandler interface
IClient interface

RemoveServerView method

(IClient interface)
Syntax 
Procedure RemoveServerView (Const AView : IServerView);
Description 
This procedure removes a server view (representing a server document window) from Altium Designer.
See also 
GetCurrentView method
IClient interface

ShowDocumentDontFocus method

(IClient interface)
Syntax 
Procedure ShowDocumentDontFocus(ADocument : IServerDocument);
Description 
This procedure fetches the IServerDocument parameter and then displays this design document but leaves the previously focussed document in focus. If there are not design documents open already, then this design document will still be displayed but not focussed.
See also 
OpenDocument method
ShowDocument method
IServerDocument interface
IClient interface

ShowDocument method

(IClient interface)
Syntax 
Procedure ShowDocument (ADocument : IServerDocument);
Description 
This procedure fetches the IServerDocument parameter which represents the Server Document loaded in Altium Designer and then displays the design document in Altium Designer.
IServerDocument example 
This example gets the client interface and then opens and shows a document.

 

Procedure  OpenAndShowADocument(Filename  :  TDynamicString);
Var
  ReportDocument  :  IServerDocument;
Begin
  If  Client  =  Nil  Then  Exit;
  ReportDocument  :=  Client.OpenDocument('Text',FileName);
  If  ReportDocument  <>  Nil  Then
  Client.ShowDocument(ReportDocument);
End;

 

See also 
OpenDocument method
IServerDocument interface
IClient interface

SetCurrentView method

(IClient interface)
Syntax 
Procedure SetCurrentView(Value : IServerDocumentView); 
Description 
This procedure fetches the IServerDocumentView parameter to set this document form as the current view in Altium Designer.
See also 
GetCurrentView method
CurrentView property
IClient interface

StopServer method

(IClient interface)
Syntax 
Function StopServer (AModuleName : WideString) : Boolean;
Description 
The StartServer and StopServer properties can be used to load a server in Altium Designer if it has not loaded already, before you can invoke this server's processes and to stop this server once you have done with these server processes. This can be used to conserve computer's memory. 
The StartServer function is usually used if you need to load a design document and execute the server's processes or its API functions if the server has not been loaded yet. Example, during a blank session of Altium Designer where there are no PCB documents open, and you need to use the PCB API to manipulate the contents on a PCB document, you would need to "start" the PCB server first so the PCB API is made active.
Example of the StopServer method 
Client.StopServer('PCB');
See also 
StartServer method
IClient interface

StartServer method

(IClient interface)
Syntax 
Function StartServer (AModuleName : WideString) : Boolean;
Description 
The StartServer and StopServer properties can be used to load a server in Altium Designer if it has not already, before you can invoke this server's processes and to stop this server once you have done with these server processes. This can be used to conserve computer's memory. 
The StartServer function is usually used if you need to load a design document and execute the server's processes or its API functions if the server has not been loaded yet. Example, during a blank session of Altium Designer where there are no PCB documents open, and you need to use the PCB API to manipulate the contents on a PCB document, you would need to "start" the PCB server first so the PCB API is made active.
Example of the StartServer method 
Client.StartServer('PCB');
See also 
StopServer method
IClient interface

UnregisterNotificationHandler method

(IClient interface)
Syntax 
Procedure UnregisterNotificationHandler(Const Handler : INotificationHandler);
Description 
The UnregisterNotificationHandler method un registers the notification handler from Client once the server object goes out of scope (destroyed). The Handler parameter contains the server module object.
Notes 
The INotificationHandler object interface is responsible for handling notifications raised in Altium Designer.
Each server object has a HandleNotification procedure to handle notifications when the options values have been adjusted from the system wide Preferences dialog. 
The HandleNotification procedure would involve calls to update the server preferences values on the server panel for example every-time a specific server notification code is intercepted.
This method is normally used for in developing servers and not for scripts.
See also 
BroadcastNotification
DispatchNotification
RegisterNotificationHandler method
INotificationHandler interface
IClient interface

AddViewToFavorites method

(IClient interface)
Syntax 
Function AddViewToFavorites(Const AView : IServerDocumentView; AIsSnippet : Boolean) : Boolean;
Description

Example

See also 
IClient interface

GetDynamicHelpManager method

(IClient interface)
Syntax 
Function GetDynamicHelpManager : IDynamicHelpManager;
Description 
The method returns the Dynamic Help manager which represents the Knowledge Center panel in Altium Designer.
See also 
IClient interface
IDynamicHelpManager interface.

IClient Properties

ApplicationHandle property

(IClient interface)
Syntax 
Property ApplicationHandle : Integer
Description 
The ApplicationHandle property sets the application handle in a server if dialogs need to be created dynamically from your server and every time a dialog that appears in front of Altium Designer will inherit Altium Designer's icon and appear as one whole application on the task bar. 
This ApplicationHandle property can be passed as a parameter for the create constructor of a dynamic dialog for example.
Note 
Normally script writers will not need to worry about this applicationhandle property. This property is used by the server writers as part of the Altium Designer SDK.
Server Example 
In the server project's main unit

 

Function  ServerFactory  (AClient  :  IClient)  :  IServerModule;  Safecall;
Begin
  Result  :=  TAddOn.Create(AClient,  'AddOn');
  Application.Handle  :=  Client.ApplicationHandle;
End;

 

In the server project's commands unit

 

Procedure  DisplayResultsOnDialog(PadCount  :  TDynamicString);
Var
  DisplayForm  :  TDialog;
Begin
  DisplayForm  :=  TDialog.Create(Application);
  DisplayForm.Label1.Caption  :=  PadCount;
  DisplayForm.ShowModal;
  DisplayForm.Free;
End;

 

See also 
IClient interface

CommandLauncher property

(IClient interface)
Syntax 
Property CommandLauncher : ICommandLauncher Read GetCommandLauncher;
Description 
The CommandLauncher property returns the Command Launcher interface. This interface contains the table of client's process launchers that can be used to launch a command.
Example

 

If  StringsEqual(ServerModule.ModuleName,'TextEdit')  Then
Begin
  Client.CommandLauncher.LaunchCommand(
  'TextEdit:MoveCursorToTopOfDocument',
  Nil,0,ServerDocument.View[0]);
End;

 

GetCommandLauncher example

 

ACommandLauncher  :=  Client.GetCommandLauncher;
If  ACommandLauncher  <>  Nil  Then
Begin
  ACommandLauncher.GetCommandState(Command,
  Parameters,
  View,
  Enabled,
  Checked,
  Visible,
  Caption,
  Image);
End;

 

See also 
GetCommandLauncher method
IProcessLauncher interface
ICommandLauncher interface
IClient interface

CurrentView property

(IClient interface)
Syntax 
Property CurrentView : IServerDocumentView Read GetCurrentView Write SetCurrentView;
Description 
This property returns the current document view interface which represents the current design document view in Altium Designer.
SendMessage Example

 

Client.SendMessage('PCB:Zoom''Action=Redraw'  255,  Client.CurrentView);

 

CurrentView example

 

Procedure  GrabACurrentDocumentView;
Var 
  ServerDocumentView  :  IServerDocumentView;
  FileName  :  WideString;
Begin
  ServerDocumentView  :=  Client.CurrentView;
  FileName  :=  ServerDocumentView.GetOwnerDocument.FileName;
End;

 

ViewName example

 

If  StrPas(Client.CurrentView.ViewName)  <>  UpperCase('PCBLib')  Then  Exit;

 

This code snippet uses the Client.CurrentView.ViewName method to find out the current document's type.

See also 
GetCurrentView method
SetCurrentView method
IServerDocumentView interface
IClient interface

GUIManager Property

(IClient interface)
Syntax 
Property GUIManager : IGUIManager Read GetGUIManager;
Description 
The GUIManager property returns the GUIManager interface. This Interface object deals with the Altium Designer's Graphical User Interface such as controlling the status bars, the locations and the state of panels.
See also 
IGUIManager interface
IClient interface

NavigationSystem property

(IClient interface)
Syntax 
Property NavigationSystem : INavigationSystem Read GetNavigationSystem;
Description 
The NavigationSystem property represents the Navigation system in Altium Designer. The navigation system is the workhouse for the Navigation panel which is the center-piece for net connectivity for the design project. There are three ways a design can be arranged - as a list of compiled sheets, flattened hierarchy and as a structural tree.
Example

See also 
IClient interface
INavigationSystem interface

ProcessControl property

(IClient interface)
Syntax 
Property ProcessControl : IProcessControl Read GetProcessControl;
Description 
This property returns the IProcessControl interface. This Process Control interface determines the number of "re-entrant" processes occurring, ie one client's process occurring stacked on top of another active client's process - this is the process depth. If a process control's process depth is zero, it indicates that nothing is taking place in Altium Designer. Refer to the IProcessControl interface for details.
ProcessDepth Example 
ShowMessage('Current process depth ',IntToStr(Client.ProcessControl.ProcessDepth));
See also 
IClient interface
IProcessControl interface

ServerModule property

(IClient interface)
Syntax 
Property ServerModule Integer : IServerModule Read GetServerModule;
Description 
The ServerModule property is used in conjunction with the Count property to retrieve active (loaded) servers. The ServerModule property returns the IServerModule interface for the loaded server module in Altium Designer.
Note, that PCB server and Schematic server have their own IPCB_ServerInterface and ISch_ServerInterface interfaces respectively.
IServerModule example 
This example gets the Schematic's IServerModule interface and returns the number of document views open in Altium Designer

 

Var
  ServerModule  :  IServerModule;
Begin
  If  Client  =  Nil  Then  Exit;
 
  ServerModule  :=  Client.ServerModuleByName('SCH');
  ShowMessage('Doc  Count  =  '  +  IntToStr(ServerModule.DocumentCount));
End;

 

See also 
IClient interface
Count property
GetServerModule method
IServerModule interface

ServerModuleByName property

(IClient interface)
Syntax 
Property ServerModuleByName Widestring : IServerModule Read GetServerModuleByName;
Description 
The ServerModuleByName property returns the IServerModule interface if the module name is found in the Client's table of active servers. For a PCB editor, module name is PCB, for a Schematic Editor, the module name is SCH etc.
Server Names

Example

 

Var
  ServerModule  :  IServerModule;
Begin
  If  Client  =  Nil  Then  Exit;
 
  ServerModule  :=  Client.ServerModuleByName('SCH');
  ShowMessage('Doc  Count  =  '  +  IntToStr(ServerModule.DocumentCount));
End;

 

See also 
IClient interface
IServerModule interface

TimerManager property

(IClient interface)
Syntax 
Property TimerManager : ITimerManager Read GetTimerManager;
Description 
This property returns the timer manager object interface.
See also 
IClient interface
ITimerManager interface

OptionsManager property

(IClient interface)
Syntax 
Property OptionsManager : IOptionsManager Read GetOptionsManager;
Description 
This is a read only property that returns the IOptionsManager interface. This interface is responsible for managing (reading and writing) values to/from the system wide Preferences dialog in Altium Designer for the specified server.
This interface is useful for server writers who wish to add their options pages in the system wide preferences dialog and manage the controls on these options pages.
Example

 

Var
  Reader  :  IOptionsReader;
Begin
  Reader  :=  Client.OptionsManager.GetOptionsReader(NameOfServer,'');
  If  Reader  =  Nil  Then  Exit;
 
  AValue  :=  Reader.ReadBoolean(NameOfServerPreferences,SettingName,DefaultValue);
End;

 

See also 
IClient interface
IOptionsManager interface

If you find an issue, select the text/image and pressCtrl + Enterto send us your feedback.