VBA Code:
Public WithEvents vHome_Anzeigen As OnlineVariable 'Home_Anzeigewerte
Const strHome_Anzeigen As String = "Home_Anzeigen"
'deactivate 'vHome_Anzeigen' event
If Not vHome_Anzeigen Is Nothing Then vHome_Anzeigen.Undefine
Set vHome_Anzeigen = Nothing
'Online Container erstellen und mit Werten füllen
Dim m As Integer
Set vHome_Anzeigen = thisProject.OnlineVariables.Item(strHome_Anzeigen)
If vHome_Anzeigen Is Nothing Then
'if not exitst, create a new OnlineVariable container
Set vHome_Anzeigen = thisProject.OnlineVariables.CreateOnlineVariables(strHome_Anzeigen)
'add variables to the container
m = 1
Do Until m > 200
vHome_Anzeigen.Add "Zelle_Anzeige1[" & CStr(m) & "]"
vHome_Anzeigen.Add "Zelle_Anzeige2[" & CStr(m) & "]"
vHome_Anzeigen.Add "Zelle_Anzeige3[" & CStr(m) & "]"
vHome_Anzeigen.Add "Zelle[" & CStr(m) & "].Zelle_Frg"
vHome_Anzeigen.Add "Zelle[" & CStr(m) & "].CA_Modus"
m = m + 1
Loop
vHome_Anzeigen.Add "Home1_Anzeigewert1"
vHome_Anzeigen.Add "Home1_Anzeigewert2"
vHome_Anzeigen.Add "Home1_Anzeigewert3"
vHome_Anzeigen.Add "ErrX_FirstScan[1]"
End If
'activate 'VariableChange' event
vHome_Anzeigen.Define
End Sub
'event is fired when a variable value changes Home_Anzeigen
Private Sub vHome_Anzeigen_VariableChange(ByVal obVar As IVariable)
Home_Anzeigen
End Sub
'Aktivierung und Deaktivierung der Werteanzeigen auf dem Homescreen
Public Sub Home_Anzeigen()
Dim m As Integer
m = 1
Do Until m > 200
If thisProject.Variables.Item("Zelle[" & CStr(m) & "].Zelle_Frg").Value = 0 Then
thisProject.Variables.Item("Zelle_Anzeige1[" & CStr(m) & "]").Value = 0
thisProject.Variables.Item("Zelle_Anzeige2[" & CStr(m) & "]").Value = 0
thisProject.Variables.Item("Zelle_Anzeige3[" & CStr(m) & "]").Value = 0
Else
If thisProject.Variables.Item("Zelle[" & CStr(m) & "].CA_Modus").Value = 1 Then
thisProject.Variables.Item("Zelle_Anzeige1[" & CStr(m) & "]").Value = thisProject.Variables.Item("Home1_Anzeigewert1").Value
thisProject.Variables.Item("Zelle_Anzeige2[" & CStr(m) & "]").Value = thisProject.Variables.Item("Home1_Anzeigewert2").Value
thisProject.Variables.Item("Zelle_Anzeige3[" & CStr(m) & "]").Value = thisProject.Variables.Item("Home1_Anzeigewert3").Value
Else
If (thisProject.Variables.Item("Home1_Anzeigewert1").Value = 4 Or thisProject.Variables.Item("Home1_Anzeigewert1").Value = 5) Then
thisProject.Variables.Item("Zelle_Anzeige1[" & CStr(m) & "]").Value = 0
Else
thisProject.Variables.Item("Zelle_Anzeige1[" & CStr(m) & "]").Value = thisProject.Variables.Item("Home1_Anzeigewert1").Value
End If
If (thisProject.Variables.Item("Home1_Anzeigewert2").Value = 4 Or thisProject.Variables.Item("Home1_Anzeigewert2").Value = 5) Then
thisProject.Variables.Item("Zelle_Anzeige2[" & CStr(m) & "]").Value = 0
Else
thisProject.Variables.Item("Zelle_Anzeige2[" & CStr(m) & "]").Value = thisProject.Variables.Item("Home1_Anzeigewert2").Value
End If
If (thisProject.Variables.Item("Home1_Anzeigewert3").Value = 4 Or thisProject.Variables.Item("Home1_Anzeigewert3").Value = 5) Then
thisProject.Variables.Item("Zelle_Anzeige3[" & CStr(m) & "]").Value = 0
Else
thisProject.Variables.Item("Zelle_Anzeige3[" & CStr(m) & "]").Value = thisProject.Variables.Item("Home1_Anzeigewert3").Value
End If
End If
End If
m = m + 1
Loop
End Sub
This document governs the use of our Community Forum. By registering and using the platform, you accept these conditions.
The COPA-DATA Community Forum serves to encourage the exchange of information and experience about the zenon software between forum users respectively zenon users.
Please mind that any published information on the Community Forum is the subjective opinion and view based on the experience and the level of knowledge of the author. COPA-DATA does not overtake any responsibility for the content and the accuracy of the shared information.
Users of the Community Forum are encouraged to share only well-founded experiences and to point out any risks associated with the implementation of proposed solutions to problems. COPA-DATA at its absolute discretion, reserves the right to moderate the forum. In this connection COPA-DATA may remove any information containing false facts, potentially dangerous solutions, bad language or content that may insult, degrade or discriminate others. COPA-DATA may block a non-complying user from forum access if the user violated this provision.
COPA-DATA reserves the right to change this document from time to time at own discretion.
Ing. Punzenberger COPA-DATA GmbH
Karolingerstraße 7b · 5020 Salzburg · Austria
www.copadata.com