Назад
See also
DynamicDialog Object (Page 1851)
VariableStateType Property
Description
Returns the type of tag monitoring used to dynamize a property or an event: No monitoring,
quality code, or tag status. Read only access.
Index VariableStateType
0 hmiNoVariableState
1 hmiVariableQCState
2 hmiVariableState
Example:
The procedure "GetVariableStateType()" reads the type of monitoring from the current
document. In this example, the type of monitoring is output in a message:
Sub GetVariableStateType()
'VBA819
Dim objDyn As HMIDynamicDialog
Set objDyn =
ActiveDocument.Properties("Width").CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'TestVal'")
MsgBox objDyn.VariableStateType
objDyn.Delete
End Sub
See also
DynamicDialog Object (Page 1851)
VariableStateValues Property
Description
Returns the VariableStateValues listing. Use the VariableStateValues property with the Item
property to assign a value to the tag status to be used for dynamization.
Example:
In the following example the radius of a circle will be dynamically configured using the Dynamic
dialog.
The dynamization takes place be evaluating the status of a tag. If a tag does not return
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
2401
a status, a substitute value (ElseCase property) is defined, a tag name is issued and three
analog value ranges are created:
Sub AddDynamicDialogToCircleRadiusTypeAnalog()
'VBA786
Dim objDynDialog As HMIDynamicDialog
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_A", "HMICircle")
Set objDynDialog = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeDynamicDialog,
"'NewDynamic1'")
With objDynDialog
.ResultType = hmiResultTypeAnalog
.AnalogResultInfos.ElseCase = 200
'
'Activate analysis of variablestate
.VariableStateChecked = True
End With
With objDynDialog.VariableStateValues(1)
'
'define a value for every state:
.VALUE_ACCESS_FAULT = 20
.VALUE_ADDRESS_ERROR = 30
.VALUE_CONVERSION_ERROR = 40
.VALUE_HANDSHAKE_ERROR = 60
.VALUE_HARDWARE_ERROR = 70
.VALUE_INVALID_KEY = 80
.VALUE_MAX_LIMIT = 90
.VALUE_MAX_RANGE = 100
.VALUE_MIN_LIMIT = 110
.VALUE_MIN_RANGE = 120
.VALUE_NOT_ESTABLISHED = 130
.VALUE_SERVERDOWN = 140
.VALUE_STARTUP_VALUE = 150
.VALUE_TIMEOUT = 160
End With
End Sub
See also
VariableStateValues Object (Listing) (Page 1987)
DynamicDialog Object (Page 1851)
VariableTriggers Property
Description
Returns the VariableTriggers listing. Use the VariableTriggers property in order to add a tag
trigger to a VB action or C action.
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
2402
System Manual, 11/2008,
Example:
In the following example the radius of a circle is made dynamic with the aid of a VB script. A
tag trigger is used as the trigger:
Sub DynamicWithVariableTrigger()
'VBA787
Dim objVBScript As HMIScriptInfo
Dim objVarTrigger As HMIVariableTrigger
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("Circle_VariableTrigger",
"HMICircle")
Set objVBScript = objCircle.Radius.CreateDynamic(hmiDynamicCreationTypeVBScript)
With objVBScript
'Triggername and cycletime are defined by add-methode
Set objVarTrigger = .Trigger.VariableTriggers.Add("VarTrigger", hmiVariableCycleType_10s)
.SourceCode = ""
End With
End Sub
See also
VariableTriggers Object (Listing) (Page 1990)
VarName Property
Description
Defines the tag whose status is to be used in the Dynamic dialog for the purpose of dynamics,
or returns the name.
Example:
In this example the name of the trigger tag used for creating dynamics in the radius of a circle
will be output:
Sub GetVarName()
'VBA788
Dim objVBScript As HMIScriptInfo
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.Item("Circle_VariableTrigger")
Set objVBScript = objCircle.Radius.Dynamic
With objVBScript
'Reading out of variablename
MsgBox "The radius is dynamicabled with: " & .Trigger.VariableTriggers.Item(1).VarName
End With
End Sub
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
2403
See also
VariableStateValue Object (Page 1986)
VBAVersion Property
Description
Returns the VBA version number. Read only access.
Example:
In the following example the current VBA version number is output:
Sub ShowVBAVersion()
'VBA789
MsgBox Application.VBAVersion
End Sub
See also
Application Object (Page 1814)
VBE Property
Description
Returns the VB Extensibility object. Read access.
Example:
--
See also
Application Object (Page 1814)
Version Property
Description
Returns the version number of the specified application. Read only access.
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
2404
System Manual, 11/2008,
Example:
In the following example the version number of the Graphics Designer is output:
Sub ShowVersionOfGraphicsDesigner()
'VBA791
MsgBox Application.Version
End Sub
See also
Application Object (Page 1814)
Views Property
Description
Returns the Views listing. Use the Views listing to create a new copy of a picture, for instance.
Example:
In the following example a copy of the active picture is created and then activated:
Sub AddView()
'VBA792
Dim objView As HMIView
Set objView = ActiveDocument.Views.Add
objView.Activate
End Sub
See also
Views Object (Listing) (Page 1993)
Visible Property
Description
TRUE if the specified object is intended to be visible. BOOLEAN write-read access.
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
2405
Example:
In the following example a circle will be inserted into the active picture. This circle is not
intended to be visible in Runtime:
Sub HideCircleInRuntime()
'VBA793
Dim objCircle As HMICircle
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("myCircle", "HMICircle")
objCircle.Visible = False
End Sub
See also
ToolbarItem Object (Page 1970)
MenuItem Object (Page 1906)
HMIObject Object (Page 1882)
Document Object (Page 1847)
Toolbar Object (Page 1967)
Menu Object (Page 1903)
Application Object (Page 1814)
4.4.8.18 W - Z
WarningHigh Property
Description
Defines or returns the high limit value "Warning High" in the case of the BarGraph object.
The "CheckWarningHigh" property must be set to "True" in order for the limit value to be
monitored.
The display on reaching the limit value and the type of evaluation are defined via the properties
ColorWarningHigh and TypeWarningHigh.
Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the high limit value
for
an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "75".
Sub BarGraphLimitConfiguration()
'VBA794
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
2406
System Manual, 11/2008,
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeWarningHigh = False
'Activate monitoring
.CheckWarningHigh = True
'Set barcolor = "red"
.ColorWarningHigh = RGB(255, 0, 0)
'Set upper limit = "75"
.WarningHigh = 75
End With
End Sub
See also
TypeWarningHigh Property (Page 2322)
ColorWarningHigh Property (Page 2076)
CheckWarningHigh Property (Page 2062)
BarGraph Object (Page 1819)
WarningLow Property
Description
Defines or returns the low limit value "Warning Low" in the case of the BarGraph object.
The "CheckWarningLow" property must be set to "True" in order for the limit value to be
monitored.
The display on reaching the limit value and the type of evaluation are defined via the properties
ColorWarningLow and TypeWarningLow.
Example:
The "BarGraphLimitConfiguration()" procedure configures the properties of the low limit value
for
an alarm. In this example the type of evaluation will be set to "Absolute". The alarm will be
triggered at a value of "12".
Sub BarGraphLimitConfiguration()
'VBA795
Dim objBarGraph As HMIBarGraph
Set objBarGraph = ActiveDocument.HMIObjects.AddHMIObject("Bar1", "HMIBarGraph")
With objBarGraph
'Set analysis = absolute
.TypeWarningLow = False
'Activate monitoring
.CheckWarningLow = True
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
2407
'Set barcolor = "magenta"
.ColorWarningLow = RGB(255, 0, 255)
'Set lower limit = "12"
.WarningLow = 75
End With
End Sub
See also
TypeWarningLow Property (Page 2323)
ColorWarningLow Property (Page 2077)
CheckWarningLow Property (Page 2063)
BarGraph Object (Page 1819)
Width Property
Description
Defines or returns the width of an object in pixels.
Example:
In the following example three objects of different sizes will be inserted in the active picture.
Then all objects will be selected and set to the same width:
Sub ApplySameWidthToSelectedObjects()
'VBA796
Dim objCircle As HMICircle
Dim objRectangle As HMIRectangle
Dim objEllipse As HMIEllipse
Set objCircle = ActiveDocument.HMIObjects.AddHMIObject("sCircle", "HMICircle")
Set objRectangle = ActiveDocument.HMIObjects.AddHMIObject("sRectangle", "HMIRectangle")
Set objEllipse = ActiveDocument.HMIObjects.AddHMIObject("sEllipse", "HMIEllipse")
With objCircle
.Top = 30
.Left = 0
.Width = 15
.Selected = True
End With
With objRectangle
.Top = 80
.Left = 42
.Width = 40
.Selected = True
End With
With objEllipse
.Top = 48
.Left = 162
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
2408
System Manual, 11/2008,
.Width = 120
.BackColor = RGB(255, 0, 0)
.Selected = True
End With
MsgBox "Objects selected!"
ActiveDocument.Selection.SameWidth
End Sub
See also
HMIObject Object (Page 1882)
WinCCStyle property
Description
Defines the style in which the object is displayed.
User-defined Shows the object according to the respective settings.
global Shows the object in a globally defined design.
Windows Style Shows the object in Windows style.
Example
WindowBorder Property
Description
TRUE if it is intended that the application window or picture window shall be displayed with a
border in Runtime. BOOLEAN write-read access.
Example:
The "ApplicationWindowConfig" procedure accesses the properties of the application window.
In this example the application window will
Sub ApplicationWindowConfig()
'VBA797
Dim objAppWindow As HMIApplicationWindow
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
2409
Set objAppWindow = ActiveDocument.HMIObjects.AddHMIObject("AppWindow",
"HMIApplicationWindow")
With objAppWindow
.Caption = True
.CloseButton = False
.Height = 200
.Left = 10
.MaximizeButton = True
.Moveable = False
.OnTop = True
.Sizeable = True
.Top = 20
.Visible = True
.Width = 250
.WindowBorder = True
End With
End Sub
See also
PictureWindow Object (Page 1919)
ApplicationWindow Object (Page 1817)
WindowMonitorNumber property
Description
Defines the monitor on which the picture window is displayed. This requires that the system
supports more than one monitor. The attribute is only effective if the "Independent window"
attribute is set to "Yes".
1-n The number of the monitor in the operating system on which the picture window is
displayed.
Example
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
2410
System Manual, 11/2008,