In runtime, you can dynamically set the column width as soon as
the Process Analyst page is shown. This would appear seemless
to the user. Practically, you would need to call a cicode
function on a "On Page Shown" event:
The SetColumnSize function is defined as follows:
FUNCTION SetColumSize(STRING sPaObjectName, STRING sColumnName, INT iWidth)
OBJECT hPA;
OBJECT hObjectView;
OBJECT
hColumns;
OBJECT hColumn;
hPA =
ObjectByName(sPaObjectName);
hObjectView=
_ObjectGetProperty(hPA, "ObjectView");
hColumns= _ObjectGetProperty(hObjectView,
"Columns")
hColumn= _ObjectCallMethod(hColumns,
"get_ItemByName",
sColumnName)
_ObjectSetProperty(hColumn, "Width",
iWidth);
iWidth;sColumnName;sPaObjectName;sPaObjectName;
END
Note1: If you are unsure of the column name, you
can call the following cicode function to return the column name
and its current size:
FUNCTION GetColumnNameAndSize(STRING sPaObjectName)
OBJECT hPA;
OBJECT hObjectView;
OBJECT
hColumns;
OBJECT hColumn;
INT iIdx,
iWidth;
STRING sColumnName
iIdx=Input("Which column?",
"Enter a column
index:","1")
hPA = ObjectByName(sPaObjectName);
hObjectView= _ObjectGetProperty(hPA, "ObjectView");
hColumns=
_ObjectGetProperty(hObjectView, "Columns")
hColumn =
_ObjectCallMethod(hColumns, "get_Item",
iIdx);
sColumnName= _ObjectGetProperty(hColumn, "Name");
iWidth=
_ObjectGetProperty(hColumn, "Width");
Message("","Column "+sColumnName+sColumnName" has a size of "+iWidth:####,iWidth####1)
;;iIdx;;sPaObjectName;
END
Note2: you may also set the
column size only once, by using the "persist ActiveX Data between page transitions", described
in the help as follows:
"
Select this
check box to allow changes made to the control to be persisted
between pages. For example, you can select this check box if you
want an ActiveX edit control to keep the current text in the
control, so that next time the page is entered, the same text is
displayed.
The data is only persisted for that session. If
CitectSCADA runtime is shut down and restarted, the updated data is
not available.
"
|