Назад
Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the color for limit 9 will be defined as "Magenta":
Sub HMI3DBarGraphConfiguration()
'VBA582
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.Layer09Checked = True
.Layer09Color = RGB(255, 0, 255)
End With
End Sub
See also
Layer09Checked Property (Page 2180)
3DBarGraph Object (Page 1805)
Layer09Value Property
Description
Defines or returns the value for "limit 9" in the case of the 3DBarGraph object.
Monitoring only takes effect when the Layer09Checked property value is set to TRUE.
Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the value for limit 9 will be defined as "90":
Sub HMI3DBarGraphConfiguration()
'VBA583
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.Layer09Checked = True
.Layer09Value = 90
End With
End Sub
See also
Layer09Checked Property (Page 2180)
3DBarGraph Object (Page 1805)
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
2181
Layer10Checked Property
Description
TRUE if limit 10 is to be monitored in the case of the 3DBarGraph object. BOOLEAN write-
read access.
Limit value and representation are defined with the Layer10Value and Layer10Color
properties.
Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example, limit 10 will be monitored:
Sub HMI3DBarGraphConfiguration()
'VBA584
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.Layer10Checked = True
End With
End Sub
See also
Layer10Value Property (Page 2183)
Layer10Color Property (Page 2182)
3DBarGraph Object (Page 1805)
Layer10Color Property
Description
Defines or returns the color for limit 10 of the 3DBarGraph object. LONG write-read access.
When monitoring of the limit value is activated (Layer10Checked property), the bar turns to
the color defined by this attribute on reaching the limit value.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Specify the corresponding decimal
value for each of the three RGB values (value range from 0 to 255).
Use VBA function "RGB" to assign a color to a property. The color "red", for example, is
represented as follows: RGB(255, 0, 0)
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
2182
System Manual, 11/2008,
Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the color for limit 10 will be defined as "Magenta":
Sub HMI3DBarGraphConfiguration()
'VBA585
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.Layer10Checked = True
.Layer10Color = RGB(255, 0, 255)
End With
End Sub
See also
Layer10Checked Property (Page 2182)
3DBarGraph Object (Page 1805)
Layer10Value Property
Description
Defines or returns the value for "limit 10" in the case of the 3DBarGraph object.
Monitoring only takes effect when the Layer10Checked property value is set to TRUE.
Example:
The "HMI3DBarGraphConfiguration()" procedure accesses the properties of the 3DBarGraph
object. In this example the value for limit 10 will be defined as "100":
Sub HMI3DBarGraphConfiguration()
'VBA586
Dim obj3DBar As HMI3DBarGraph
Set obj3DBar = ActiveDocument.HMIObjects.AddHMIObject("3DBar1", "HMI3DBarGraph")
With obj3DBar
.Layer10Checked = True
.Layer10Value = 100
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,
2183
See also
Layer10Checked Property (Page 2182)
3DBarGraph Object (Page 1805)
LayerDecluttering Property
Description
TRUE if showing and hiding objects dependent upon the minimum and maximum zoom set
for a layer has been enabled. BOOLEAN write-read access.
Example:
In the following example the settings for the lowest layer are configured in the active picture:
Sub ConfigureSettingsOfLayer()
'VBA587
Dim objLayer As HMILayer
Set objLayer = ActiveDocument.Layers(1)
With objLayer
'configure "Layer 0"
.MinZoom = 10
.MaxZoom = 100
.Name = "Configured with VBA"
End With
'define fade-in and fade-out of objects:
With ActiveDocument
.LayerDecluttering = True
.ObjectSizeDecluttering = True
.SetDeclutterObjectSize 50, 100
End With
End Sub
See also
Document Object (Page 1847)
Editing Layers with VBA (Page 1603)
Layers Property
Description
Returns a listing containing the properties of the layers in the current picture.
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
2184
System Manual, 11/2008,
Note
If the "Layers" property is used, the sequence of HMI objects in the HMIObjects listing can
change.
Example:
The "LayerInfo()" procedure outputs the name and zoom configuration for each layer of the
current picture:
Sub LayerInfo()
'VBA588
Dim colLayers As HMILayers
Dim objLayer As HMILayer
Dim iAnswer As Integer
Set colLayers = ActiveDocument.Layers
For Each objLayer In colLayers
With objLayer
iAnswer = MsgBox("Layername: " & .Name & vbCrLf & "max. zoom: " & .MaxZoom & vbCrLf & "min.
zoom: " & .MinZoom, vbOKCancel)
End With
If vbCancel = iAnswer Then Exit For
Next objLayer
End Sub
See also
Name Property (Page 2228)
MinZoom Property (Page 2226)
MaxZoom Property (Page 2208)
Layers Object (Listing) (Page 1895)
Layer Object (Page 1894)
LD - Lo
LDFonts Property
Description
Returns a listing containing the language identifiers for the configured fonts.
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
2185
Example:
Use the LDFonts property to return the LanguageFonts listing. In the following example the
language identifiers of the configured fonts will be output:
Sub ShowLanguageFont()
'VBA589
Dim colLanguageFonts As HMILanguageFonts
Dim objLanguageFont As HMILanguageFont
Dim objButton As HMIButton
Dim iMax As Integer
Dim iAnswer As Integer
Set objButton = ActiveDocument.HMIObjects.AddHMIObject("myButton", "HMIButton")
Set colLanguageFonts = objButton.LDFonts
iMax = colLanguageFonts.Count
For Each objLanguageFont In colLanguageFonts
iAnswer = MsgBox("Projected fonts: " & iMax & vbCrLf & "Language-ID: " &
objLanguageFont.LanguageID, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objLanguageFont
End Sub
See also
StaticText Object (Page 1956)
OptionGroup Object (Page 1916)
LanguageFonts Object (Listing) (Page 1890)
CheckBox Object (Page 1827)
Button Object (Page 1824)
LDLabelTexts Property
Description
Returns a listing containing the multilingual labels of the user-defined menu or menu entry.
Example:
The "CreateMenuItem()" procedure creates the "Delete Objects" menu and adds two menu
entries ("Delete Rectangles" and "Delete Circles"): In this example, multilingual menu labels
will be created:
Sub CreateMenuItem()
'VBA590
Dim objMenu As HMIMenu
Dim objMenuItem As HMIMenuItem
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
2186
System Manual, 11/2008,
Dim objLangText As HMILanguageText
'
'Add new menu "Delete objects" to menubar:
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DeleteObjects", "Delete objects")
'
'Add two menuitems to the new menu
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(1, "DeleteAllRectangles", "Delete
rectangles")
Set objMenuItem = objMenu.MenuItems.InsertMenuItem(2, "DeleteAllCircles", "Delete circles")
'
'Define foreign-language labels for menu "Delete objects":
Set objLangText = objMenu.LDLabelTexts.Add(1033, "English_Delete objects")
Set objLangText = objMenu.LDLabelTexts.Add(1032, "Greek_Delete objects")
Set objLangText = objMenu.LDLabelTexts.Add(1034, "Spanish_Delete objects")
Set objLangText = objMenu.LDLabelTexts.Add(1036, "French_Delete objects")
End Sub
The "LDLabelInfo()" procedure outputs the labels configured for the "Delete Objects" menu:
Sub LDLabelInfo()
'VBA591
Dim colLangTexts As HMILanguageTexts
Dim objLangText As HMILanguageText
Dim iAnswer As Integer
'
'Save all labels of menu into collection "colLangTexts":
Set colLangTexts = ActiveDocument.CustomMenus("DeleteObjects").LDLabelTexts
For Each objLangText In colLangTexts
iAnswer = MsgBox(objLangText.DisplayName, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objLangText
End Sub
See also
MenuItem Object (Page 1906)
Menu Object (Page 1903)
LDNames Property
Description
Returns a listing containing the multilingual names of a folder in the Components Library or of
a layer.
Example:
Use the LDNames property to return the LanguageTexts listing. In the following example all
multilingual layer names will be output:
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
2187
Explanation: What the example shows
Sub LDLabelInfo()
'VBA592
Dim colLayerLngTexts As HMILanguageTexts
Dim objLayerLngText As HMILanguageText
Dim iIndex As Integer
Dim iAnswer As Integer
Dim strResult As String
iIndex = 1
For iIndex = 1 To ActiveDocument.Layers.Count
'
'Save all labels of layers into collection of "colLayerLngTexts":
Set colLayerLngTexts = ActiveDocument.Layers(iIndex).LDNames
For Each objLayerLngText In colLayerLngTexts
strResult = strResult & vbCrLf & objLayerLngText.LanguageID & " - " &
objLayerLngText.DisplayName
Next objLayerLngText
iAnswer = MsgBox(strResult, vbOKCancel)
strResult = ""
If vbCancel = iAnswer Then Exit For
Next iIndex
End Sub
See also
Layer Object (Page 1894)
LanguageTexts Object (Listing) (Page 1893)
FolderItem Object (Page 1867)
LDStatusTexts Property
Description
Returns a listing containing the multilingual status line texts of a user-defined icon or menu
entry.
Example:
The "CreateMenuItem()" procedure creates the "Delete Objects" menu and adds two menu
entries
("Delete Rectangles" and "Delete Circles"). In this example, multilingual status line texts
will be created:
Sub CreateMenuItem()
'VBA593
Dim objMenu As HMIMenu
Dim objMenuItem1 As HMIMenuItem
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
2188
System Manual, 11/2008,
Dim objMenuItem2 As HMIMenuItem
Dim objLangStateText As HMILanguageText
'
'Add new menu "Delete objects" to menubar:
Set objMenu = ActiveDocument.CustomMenus.InsertMenu(1, "DeleteObjects", "Delete objects")
'
'Add two menuitems to the new menu
Set objMenuItem1 = objMenu.MenuItems.InsertMenuItem(1, "DeleteAllRectangles", "Delete
rectangles")
Set objMenuItem2 = objMenu.MenuItems.InsertMenuItem(2, "DeleteAllCircles", "Delete
circles")
'
'Define foreign-language labels for menuitem "Delete rectangles":
Set objLangStateText = objMenuItem1.LDStatusTexts.Add(1033, "English_Delete rectangles")
Set objLangStateText = objMenuItem1.LDStatusTexts.Add(1032, "Greek_Delete rectangles")
Set objLangStateText = objMenuItem1.LDStatusTexts.Add(1034, "Spanish_Delete rectangles")
Set objLangStateText = objMenuItem1.LDStatusTexts.Add(1036, "French_Delete rectangles")
End Sub
The "LDStatusTextInfo()" procedure outputs the status line texts configured for the "Delete
Objects" menu:
Sub LDStatusTextInfo()
'VBA594
Dim colMenuItems As HMIMenuItems
Dim objMenuItem As HMIMenuItem
Dim colStatusLngTexts As HMILanguageTexts
Dim objStatusLngText As HMILanguageText
Dim strResult As String
Dim iAnswer As Integer
Set colMenuItems = ActiveDocument.CustomMenus("DeleteObjects").MenuItems
For Each objMenuItem In colMenuItems
strResult = "Statustexts of menuitem """ & objMenuItem.Label & """"
Set colStatusLngTexts = objMenuItem.LDStatusTexts
For Each objStatusLngText In colStatusLngTexts
strResult = strResult & vbCrLf & objStatusLngText.DisplayName
Next objStatusLngText
iAnswer = MsgBox(strResult, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objMenuItem
End Sub
See also
ToolbarItem Object (Page 1970)
MenuItem Object (Page 1906)
Menu Object (Page 1903)
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
2189
LDTexts Property
Description
Returns a listing containing the multilingual labels of an object.
Example:
The "LDTextInfo()" procedure outputs the labels configured for the Button object. For this
example to work, create the object "myButton" in the Graphics Designer and configure a
number of multilingual labels:
Sub LDTextInfo()
'VBA595
Dim colLDLngTexts As HMILanguageTexts
Dim objLDLngText As HMILanguageText
Dim objButton As HMIButton
Dim iAnswer As Integer
Set objButton = ActiveDocument.HMIObjects("myButton")
Set colLDLngTexts = objButton.LDTexts
For Each objLDLngText In colLDLngTexts
iAnswer = MsgBox(objLDLngText.DisplayName, vbOKCancel)
If vbCancel = iAnswer Then Exit For
Next objLDLngText
End Sub
See also
Button Object (Page 1824)
StaticText Object (Page 1956)
OptionGroup Object (Page 1916)
CheckBox Object (Page 1827)
LDTooltipTexts Property
Description
Returns a listing containing the multilingual Tooltip texts for a user-defined icon or for an object.
Example
The "CreateToolbar()" procedure creates a user-defined toolbar with two icons. Two
multilingual Tooltip texts are assigned to the first icon:
Sub CreateToolbar()
VBA for Automated Configuration
4.4 The object model of the Graphics Designer
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
2190
System Manual, 11/2008,