3. To add dynamics to an object property with a C script, you can for example insert an
"AddDynamicAsCScriptToProperty()" procedure in the document. In this example the
height of a circle is increased by 5 pixels every two seconds in runtime:
Sub AddDynamicAsCSkriptToProperty()
'VBA61
Dim objCScript As HMIScriptInfo
Dim objCircle As HMICircle
Dim strCode As String
strCode = "long lHeight;" & vbCrLf & "int check;" & vbCrLf
strCode = strCode & "GetHeight(""" & "events.PDL""" & ",""" &
"myCircle""" & ");" & vbCrLf
strCode = strCode & "lHeight = lHeight+5;" & vbCrLf
strCode = strCode & "check = SetHeight("""events.PDL""",
"""myCircle""",lHeight);"
strCode = strCode & vbCrLf & "//Return-Type: BOOL" & vbCrLf
strCode = strCode & "return check;"
Set objCircle =
ActiveDocument.HMIObjects.AddHMIObject("myCircle", "HMICircle")
'Create dynamic for Property "Height":
Set objCScript =
objCircle.Height.CreateDynamic(hmiDynamicCreationTypeCScript)
'
'set Sourcecode and cycletime:
With objCScript
.SourceCode = strCode
.Trigger.Type = hmiTriggerTypeStandardCycle
.Trigger.CycleType = hmiCycleType_2s
.Trigger.Name = "Trigger1"
End With
End Sub
4. Start the procedure with <F5>.
See also
Trigger Property (Page 2314)
ScriptType Property (Page 2280)
SourceCode Property (Page 2295)
CycleType Property (Page 2088)
ScriptInfo Object (Page 1948)
CreateDynamic Method (Page 1742)
How to Dynamize a Property with a VB Script (Page 1642)
How to Dynamize a Property with Dynamic Dialog (Page 1636)
How to Dynamize a Property with Tag Connection (Page 1634)
Configuring Dynamics in the Properties of Pictures and Objects (Page 1632)
Creating Dynamics with VBA (Page 1631)
VBA for Automated Configuration
4.3 VBA in the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
1641