IServerModule interface

Overview 
A server deals with its own server documents. There can be different design document types, for example the Schematic Editor has two Schematic and Schematic Library document types.
Each design document, in turn stores views which can be a document window or a panel window. A server has the ability to host multiple panel views for a single document view, see the diagram below. 
A server also has the ability to host multiple global panel views that represent some system state and are not necessarily tied to a particular design document (for example the Work-Space Manager server has Message, Differences and Errors panels). This document view / multiple panel views structure is the foundation of Altium Designer client / server architecture.
These IServerModule interfaces (from the EDPInterfaces unit) represent loaded servers in Altium Designer. This application manages single instances of different server modules. Each server can have multiple server document kinds, for example the PCB server supports two server document kinds - PCB and PCBLIB design documents. A loaded server in Altium Designer typically hosts documents and each document in turn hosts a document view and panel views.
The diagram below represents a server module with server documents. Each document has views - the document view and the associated panel view.

Notes 
An IServerModule interface has the following interfaces:
• ICommandLauncher deals with a server's processes table
• IServerDocument represents a loaded design document in Altium Designer
• IServerView represents a panel that can have a view of the Altium Designer system
• IServerDocumentView (deals with a document view (either the document window or panel window)
• IExternalForm represents a Altium Designer aware Delphi form either as a document form or a panel form. These forms are wrapped by the IServerDocumentView or IServerView interface object. This IExternalForm interface object has low level methods such as resizing and displaying the form and is the ancestor interface for IServerDocumentView and IServerView interfaces.
• IProcessControl represents the level of stacked processes for this focussed server document
• INotification receives system notifications from the Client system and all server modules receive these notifications. There is an ability to handle a notification and take it from there. Documents and associated panels can be synchronized through the use of notifications as well.


Notes 
The PCB server module also has its IPCB_ServerInterface interface.
The Schematic Server module also has its ISCH_ServerInterface interface.
However both servers also have this IServerModule interface.
IServerModule Methods and Properties Table

IServerModule 
methods 
ApplicationIdle
ReceiveNotification
CreateDocument
DestroyDocument
CreateOptionsView
CreateServerView
CreateServerDocView
RemoveServerView
AddServerView
CreateDocumentShowOrHide

IServerModule 
Properties 
Client
CommandLauncher
Handle
ModuleName
ProcessControl
DocumentCount
Documents
ViewCount
Views

See also 
IPCB_ServerInterface interface
ISCH_ServerInterface interface

IServerModule GetState and SetState Methods

GetClient method

(IServerModule interface)
Syntax 
Function GetClient : IClient;
Description 
The GetClient method returns the IClient interface of the client subsystem of Altium Designer. This IClient interface can be used to invoke its methods.
The GetClient method is used for the Client property.
Example

See also 
IServerModule interface

GetCommandLauncher method

(IServerModule interface)
Syntax 
Function GetCommandLauncher : ICommandLauncher;
Description 
The CommandLauncher function returns the ICommandLauncher interface. It is used to launch a process from its server module. The CommandLauncher object contains a command table which binds a process name to the actual function that implements the process at run-time.
Whenever a process is called within the server this table is looked up in order to find the actual function pointer. If a process name is not found within this table then nothing will happen. 
This CommandLauncher object is initialized in the main.pas unit of a server project. See the ICommandLauncher interface for more details.
This method is used for the CommandLauncher property.
Example

See also 
IServerModule interface

GetDocumentCount method

(IServerModule interface)
Syntax 
Function GetDocumentCount : Integer;
Description 
The DocumentCount method returns you the number of Document Kinds. An important note is that a View is the actual design document. A Document type is a container that stores specific Views.
This method is used for the DocumentCount property.
Example

See also 
IServerModule interface

GetDocuments method

(IServerModule interface)
Syntax 
Function GetDocuments (Index : Integer) : IServerDocument;
Description 
An editor type of server can have different document types, such as Schematic Editor and PCB Editor - these editor servers have two document types - SCH/SCHLIB and PCB/PCBLIB respectively.
An add-on type of server will normally have no document containers, because they work with an editor server acting like a piggy back and utilising the editor server's API services.
This method returns you the indexed document container which is represented by the IServerDocument interface.
This method is used for the Documents property.
Example

See also 
IServerModule interface
IServerDocument interface

GetHandle method

(IServerModule interface)
Syntax 
Function GetHandle : THandle;
Description 
The method returns the handle of the server.
This method is used for the Handle property.
Example

See also 
IServerModule interface

GetModuleName method

(IServerModule interface)
Syntax 
Function GetModuleName : Widestring;
Description 
The method returns the module name of this server.
For example the texteditor server's module name is TextEdit. This server name property is defined in the associated server installation file (with an INS file extension).
This method is used for the ModuleName property.
Example

See also 
IServerModule interface

GetProcessControl method

(IServerModule interface)
Syntax 
Function GetProcessControl : IProcessControl;
Description 
The method returns the IProcessControl interface. This interface controls the process depth for each design document in Altium Designer. 
Every time a process is launched on a document, the process depth is increased by one and once this same process has finished executing, the process depth is decreased by one. When the process depth is zero, it denotes that nothing is taking place on the current design document.
This read only property is supported by the GetProcessControl method.
Example

See also 
IServerModule interface

GetViewCount method

(IServerModule interface)
Syntax 
Function GetViewCount : Integer;
Description 
The ViewCount method returns you the number of views for the specified server.
A View object encapsulates a form/window object in Altium Designer normally as a global panel supported by its associated server.
This method is used for the ViewCount property.
Example

See also 
IServerModule interface

GetViews method

(IServerModule interface)
Syntax 
Function GetViews (Index : Integer) : IServerView;
Description 
The GetViews method in conjunction with the GetViewCount method returns you the indexed View object. A view is a form supported by its associated server.
This method is used for the Views property.
Example

See also 
IServerModule interface

IServerModule Methods

AddServerView method

(IServerModule interface)
Syntax 
Procedure AddServerView (Const AView : IServerView);
Description 
This procedure adds a panel in the Server Module where this new panel can be used by the module.
Invoke this function after you have created a IServerView object with the CreateServerView function or pass in the IServerView interface parameter.
Example

See also 
IServerModule interface
IServerView interface

ApplicationIdle method

(IServerModule interface)
Syntax 
Procedure ApplicationIdle;
Description 
The ApplicationIdle procedure is an internal procedure that gets invoked when Altium Designer is idling. The ApplicationIdle procedure in all active running servers gets invoked. The messages sent by Altium Designer get the chance to be followed up.
Example

See also 
IServerModule interface

CreateDocument method

(IServerModule interface)
Syntax 
Function CreateDocument (Const AKind, AFileName : Widestring) : IServerDocument;
Description 
The CreateDocument function creates a document supported by the server based on the AKind and AFilename parameters. 
The AKind parameter represents the document kind that the server supports and the AFileName parameter is assigned to the new document.
Example

See also 
IServerModule interface

CreateServerDocView method

(IServerModule interface)
Syntax 
Function CreateServerDocView (Const AName : Widestring; Const ADocument : IServerDocument): IServerDocumentView;
Description 
The CreateServerDocView function creates an IServerDocumentView (which could be the document or its associated panel view) object based on the Name of the document view and the IServerDocument container.
Example

See also 
IServerModule interface

CreateServerView method

(IServerModule interface)
Syntax 
Function CreateServerView (Const AName : Widestring) : IServerView;
Description 
The CreateServerView function creates a IServerView object representing a system panel. You need to invoke the AddServerView procedure to add the object within Altium Designer.
Example

See also 
IServerModule interface

CreateOptionsView method

(IServerModule interface)
Syntax 
Function CreateOptionsView (Const AName : Widestring) : IDocumentOptionsView;
Description 
The CreateOptionsView creates a IDocumentOptions view to be used in the system wide Preferences dialog in Altium Designer.
Example

See also 
IServerModule interface

DestroyDocument method

(IServerModule interface)
Syntax 
Procedure DestroyDocument (Const ADocument : IServerDocument);
Description 
The DestroyDocument procedure closes and removes the design document as specified by the ADocument parameter.
Example

See also 
IServerModule interface

ReceiveNotification method

(IServerModule interface)
Syntax 
Procedure ReceiveNotification (Const ANotification : INotification);
Description 
The ReceiveNotification procedure of the server module intercepts notifications broadcasted by Altium Designer.
The system has a BroadCastNotification or a DispatchNotification function which all running servers in Altium Designer can receive and process accordingly.
This procedure needs to be overridden and implemented.
Example

See also 
IServerModule interface

RemoveServerView method

(IServerModule interface)
Syntax 
Procedure RemoveServerView (Const AView : IServerView);
Description 
The RemoveServerView procedure removes a IServerView object in Altium Designer which represents a system panel.
Example

See also 
IServerModule interface

CreateDocumentShowOrHide method

(IServerModule interface)
Syntax 
Function CreateDocumentShowOrHide(Const AKind, AFileName : Widestring;
AShowInTree : Boolean) : IServerDocument;
Description 
The CreateDocumentShowOrHide function controls how a document when created is displayed in Altium Designer.
Example

See also 
IServerModule interface

Properties

Client property

(IServerModule interface)
Syntax 
Property Client : IClient Read GetClient;
Description 
The Client property returns the IClient interface of the client subsystem of Altium Designer. This IClient interface can be used to invoke its methods.
This readonly property is supported by the GetClient method.
Example

See also 
IServerModule interface

CommandLauncher property

(IServerModule interface)
Syntax 
Property CommandLauncher : ICommandLauncher Read GetCommandLauncher;
Description 
The CommandLauncher property returns the pointer to the ICommandLauncher interface. It is used to launch a process from its server module. The CommandLauncher object contains a command table which binds a process name to the actual function that implements the process at run-time.
Whenever a process is called within the server this table is looked up in order to find the actual function pointer. If a process name is not found within this table nothing will happen. 
This CommandLauncher object is initialized in the main.pas unit of a server project. See the ICommandLauncher interface for more details.
This read-only property is supported by the GetCommandLauncher method.
Example

See also 
IServerModule interface

DocumentCount property

(IServerModule interface)
Syntax 
Property DocumentCount : Integer Read GetDocumentCount;
Description 
The DocumentCount property returns you the number of Document Kinds. An important note is that a View is the actual design document. A Document type is a container that stores specific Views.
This property is supported by the GetDocumentCount method.
Example

See also 
IServerModule interface

Documents property

(IDocuments interface)
Syntax 
Property Documents Integer : IServerDocument Read GetDocuments;
Description 
An editor type of server can have different document types, such as Schematic Editor and PCB Editor - these editor servers have two document types - SCH/SCHLIB and PCB/PCBLIB respectively.
An add-on type of server will normally have no document containers, because they work with an editor server acting like a piggy back and utilising the editor server's API services.
This property returns you the indexed document container which is represented by the IServerDocument interface.
This read only property is supported by the GetDocuments method.
Example

See also 
IClient interface
IServerModule interface
DocumentCount property

Handle property

(IServerModule interface)
Syntax 
Property Handle : THandle Read GetHandle;
Description 
The Handle property returns the handle of the server. This read only property is supported by the GetHandle method.
Example

See also 
IServerModule interface

ModuleName property

(IServerModule interface)
Syntax 
Property ModuleName : Widestring Read GetModuleName;
Description 
The ModuleName property returns the module name of this server. 
For example the Texteditor server's module name is TextEdit. This server name property is defined in the associated server installation file (with an INS file extension).
This read only property is supported by the GetModuleName method.
Example

 

If  StringsEqual(ServerModule.ModuleName,'TextEdit')  Then
Begin
...
End;

 

See also 
IServerModule interface

ProcessControl property

(IServerModule interface)
Syntax 
Property ProcessControl : IProcessControl Read GetProcessControl;
Description 
The ProcessControl property returns the pointer to the IProcessControl interface. This interface controls the process depth for each design document in Altium Designer. 
Every time a process is launched on a document, the process depth is increased by one and once this same process has finished executing, the process depth is decreased by one. When the process depth is zero, it denotes that nothing is taking place on the current design document.
This read only property is supported by the GetProcessControl method.
Example

See also 
IServerModule interface

ViewCount property

(IServerModule interface)
Syntax 
Property ViewCount : Integer Read GetViewCount;
Description 
The ViewCount property returns you the number of views for the specified server.
A View object encapsulates a form/window object in Altium Designer normally as a global panel supported by its associated server.
This read only property is supported by the GetViewCount method.
Example

See also 
IServerModule interface

Views property

(IServerModule interface)
Syntax 
Property Views Integer : IServerView Read GetViews;
Description 
The Views property in conjunction with the ViewCount property returns you the indexed View object. A view is a form supported by its associated server.
This read only property is supported by the GetViews method.
Example

See also 
IClient interface
IServerModule interface

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