• No results found

Main Form

In document PDMS PML Manual - 2 (Page 64-66)

AUTOLIMITS N1000 E2500 U0 TO N3000 E5000 U2000 AUTOLIMITS /EQUI2 /EQU

22. PML Add-ins A PML add-in can:

22.1. Application Switching

22.1.1. Main Form

The main form is now stored as a PML Form. For DESIGN, this is !!appDesMain and for DRAFT it is !!appDraMain. These contain the basic gadgets and menu-options common to all applications in the module. All others are created using add-ins. We recommend that you create add-ins to modify the main form rather than editing the standard product code.

22.1.2. Callbacks

Each application can now have different types of callback, which are run at different times: Callback When Executed

module startup calls Runs when PDMS first starts. startup calls Runs the first time the application loads.

switch calls Runs every time PDMS switches into the application. 22.1.3. Defining an Add-in

Each add-in is specified by an add-in definition file, with pathname PDMSUI%\<module>\ADDINS\<addin>, where <module> is the module name e.g. DES, and <addin> is the addin name e.g. MYADDIN. This is similar in format to the entries in the old APPLICATIONS file. Each line contains a key and description, separated by a colon. Some keys are available to all add-ins; others can be used only for applications, since they refer to menu text, gadgets and callbacks specific to that application. The following can be used by all add-ins.

Name The unique identifier of the add-in, e.g. GEN, DES. This key is compulsory.

Title Text description of the add-in (if the add-in defines an application, the title appears in the title bar of the main window when the application is loaded)

ShowOnMenu Determines whether the add-in has an entry on the Applications menu, i.e. whether the add-in defines an application (false by default).

Object Add-in object: user-defined object type used to help define the add-in, e.g. APPGENERAL

ModuleStartup Callback run when the PDMS module first starts

StartupModify Name of application to modify and the callback run when an application is first started, separated by a colon. e.g. EQUI:!!equiAppStartupCall().

SwitchModify Name of application to modify and the callback to run when the application is switched to, separated by a colon.e.g. PIPE:!!pipeAppSwitchCall()

The following keys are only used for applications, i.e. add-ins that have a menu option on the Applications menu and can be switched to.

Menu Entry for application on the applications menu (the title is used if this isn’t specified) Directory Name of the application directory under %PDMSUI%\module

Synonym Synonym created for the directory (only used if the directory is specified)

Group Group number (applications with the same group number are put into a submenu together)

GroupName Description of submenu to appear on main menu

Gadgets Integer specifying the gadgets that appear on main form for this application: 1 - no gadgets

2 - sheet/library gadgets

3 - sheet/library and layer gadgets 4 - sheet/library and note/vnote gadgets

Type Type of application for user applications. Valid values are DRA, DIM, LAB, USR1, USR2, USR3, USR4, USR5.

SwitchCall Callback to be run every time the application is switched to. StartupCall Callback run when the application first starts.

To make it easier for user-defined add-ins to modify existing applications, it is possible for an add-in to add a startup or switch call to an application. You can do this by adding the lines of the following form to the add-in file.

startupModify: APPNAME: callback switchModify: APPNAME: callback

where APPNAME is the name of the application to modify and callback is the callback to be assigned to it. If an application with name APPNAME is not defined, the callback is not run. 22.1.4. Add-in Object

A user-defined object type, the add-in object, is used to define toolbars and menus for an add-in. An instance of this object is created and its methods are run at specific points. The method .modifyForm() of each add-in object is called during definition of the main form so that add-ins may create their own toolbars on the main form; .modifyMenus() is called when starting PDMS to create menu options. For applications, .initialiseForm() is called when switching to the application. It is not mandatory for all these methods to be present, and if one is not present, execution continues as normal. It is possible to specify no object if you wish only to use the other

properties of the add-in. 22.1.5. Initialisation

The add-in definitions are loaded from file during PDMS startup using the function !!appReadAppDefns(!module is STRING), where !module is the 3-letter identifier for the module. This creates the global !!appCntrl object, which holds information about the add-ins. After reading the definitions of all add-ins, !!appCntrl assigns all callbacks to the applications. For backward compatibility, if an add-in is an application, a directory is specified for the application and the file module\directory\INIT exists, then this file is added as a startup-call. Similarly, if the file module\directory\ISYSTEM exists, it is added as a switch call.

22.2. Menus

Each add-in is able to specify menus that can be shown, along with the application in which they can be shown. Menus are created by running the .modifyMenus() method of the add-in object when PDMS first starts.

In document PDMS PML Manual - 2 (Page 64-66)