pvAddColumn()
Adds a column with the specified label to the project view.
This function is for use in the projectView.ctl file only (wincc_oa_path/[Version]/scripts/gedi/projectView.ctl). It is not advised to overwrite the original file, because this is effective WinCC OA wide. Instead, copy the original file to your project directory and make changes there. Thus the changes will only have an effect project-wide.
Synopsis
intpvAddColumn(string label, mapping options);
Parameters
Parameter | Description |
---|---|
label | Column label. |
options |
Options for the column that is added: "icon" (string): relative path to an image in the /pictures directory. "visualIndex" (int): where the column should be added ( index >= 0). "doubleClicked" or "rightMousePressed" (string): Function name, which must be available in the same script. The function is called when you right-click or double-click on the column. The function has two parameters: string fileName (The file which is clicked in the project view), int column (the column that is clicked in the project view). "width" (int) ... define the initial column width "resizeMode" (string) ... The mode can be one of the following strings:
"visible" (bool): defines if the column shall initially be visible (default: true). "tooltip" ( string): a tooltip which is shown when hovering over the columns header. |
Return value
Number of the new column.
Error
Missing or wrong arguments
Description
Adds a column with the specified label to the project view.
If a new column is added, with only an icon and no text, the width of the column is set to the size of the icon and the resizeMode is changed to "Fixed". This default behavior can be overridden by manually passing the "width" and "resizeMode" key to the options mapping.
EXAMPLE
The following example shows how to add columns to the project view. The script contains a dpConnect() call. Via the call columns are added to the project view of GEDI. Proceed as follows:
-
To execute the script, create a dyn_string data point as shown in the figure below.
-
Save the following script as the projectView.ctl under WinCC_OA_Proj/scripts/gedi/projectView.ctl. and restart GEDI. You can also copy the script "projectView.ctl." from the WinCC OA version directory and replace the code by the following code.
-
Add column names to the data point via PARA as shown in the figure below.
-
The columns are added to GEDI.
-
#uses "CtrlPv2Admin" //-------------------------------------------------------------------------------- main() { if ( !isEvConnOpen() ) return; dpConnect("callback", true, "dpDynString."); } callback(string dp, dyn_string values) { pvRemoveAllUserColumns(); for( int i = 1; i <= dynlen(values); i++) { string rs = "rightMousePressed"; mapping m; m["icon"] = "StandardIcons/apply_20.png"; m["visualIndex"] = i; m["rightMousePressed"] = rs; pvAddColumn(values[i], m); } } rightMousePressed(string fileName,int column) //file = file that is clicked, column = column that is clicked { DebugN("File " + fileName, "clicked"); }
Figure: How to add columns to the project view
Availability
UI