Cicode Programming Reference > Cicode Function Categories > Process Analyst Functions Introduction > ProcessAnalystSetPen


Works like the existing function TrnSetPen(). Allows a new pen to be added to a PA display. The pane defaults to the first pane of the PA if it is not specified.


ProcessAnalystSetPen((iPen, sTag [, sObjName [, iPane]]) )


Pen number. The allowed values are:

<0 - new pen

0 - the currently selected pen

existing pen number - change existing pen

>existing pen number - new pen

Up to 8 pens can be added to the PA using the Cicode function if ObjName is set to "-2".

Be reminded that unlike trend objects, the pen numbers in Process Analyst are not fixed. They are dynamically reassigned when pens are added or deleted. When setting pens to the Process Analyst on the current display, pens are numbered within the scope of the pane they are in. On the other hand, when setting pens for the next display, pens are numbered in a flat scope regardless of pane number specified.


The trend tag name to be assigned to the pen.


The name of the PA object. If this is set to "-2", the pen is set to the next displayed PA page set up by ProcessAnalystSelect(). If the specified ObjName is valid, the changes will be applied to the currently displayed PA. Otherwise, the function will try to set the pen to the specified object on the currently displayed page. If this parameter is not specified or is an empty string, it will default to the object name used in the tab style templates, that is "_templatePA1".


Optional number of the pane where the trend or variable tags are added. Please see the same parameter for function PageProcessAnalystPens() for details. Defaulted to 0, that is, the first pane.

Return Value

0 (zero) if successful, otherwise an error is returned.

Related Functions

PageProcessAnalyst, PageProcessAnalystPens, ProcessAnalystLoadFile, ProcessAnalystPopup, ProcessAnalystSelect, ProcessAnalystWin, TrnSetPen, WinNewAt

See Also

Process Analyst Functions