Hi all,
I have an FTView SE application where I'm trying to get one of the clients to display a popup when the PLC turns on a bit. My understanding of how this should work is:
- Create a tag in the HMI tags section of Studio, and link it to this bit in the PLC
- Using VBA, define a tag group with events
- Add said tag to tag group
- In the TagGroup_Change section of the VBA code, check if the desired tag = 1. If it is then execute Application.ShowDisplay ("popup") and set the tag back to zero
I can't get it working. So I'm trying more and more basic things to troubleshoot where I'm going wrong, and well, I can't get anything to work!
Here's my code so far.
Public WithEvents TestTags As TagGroup
Public Sub Display_AnimationStart()
Dim TestLogicInt As Integer
If TestTags Is Nothing Then
Set TestTags = Application.CreateTagGroup(Me.AreaName, 1000)
TestTags.Add "{Utilities\TestBool}"
End If
TestTags.Item("{Utilities\TestBool}").Value = False
Elements.Item("text1").Caption = TestLogicInt
End Sub
Private Sub TestTags_Change(ByVal TagNames As IGOMStringList)
TestLogicInt = TestLogicInt + 1
Elements.Item("text1").Caption = TestLogicInt
Application.ShowDisplay ("popup")
End Sub
I'm trying to be really simple about it. On my test display I have a button, a numeric display, and some text. The button toggles the TestBool tag (which is a tag not tied to the PLC, just a local HMI tag for testing). Then my numeric display shows the state of the TestBool tag. When I go to test display, clicking the button makes the numeric display change from 1 to 0 and back again, so I know the tag is changing. Then, in the tag change sub, I increment 1 and set the text to display the current count. So if this was working, every time I clicked the button, the number shown in the text box would increment, but it doesn't. It increments once when the display first starts, and then stays at 1 from then on.
One other thing to note is that I'm doing all this from the development environment. But I have tied the alarm and event server and the HMI server to my local machine, and they're running happily (in grace mode). I know that I won't be able to actually call a display from the development environment, but if I can get it as far as an error saying "you can't do that in development environment", then I know my logic at least works
I have an FTView SE application where I'm trying to get one of the clients to display a popup when the PLC turns on a bit. My understanding of how this should work is:
- Create a tag in the HMI tags section of Studio, and link it to this bit in the PLC
- Using VBA, define a tag group with events
- Add said tag to tag group
- In the TagGroup_Change section of the VBA code, check if the desired tag = 1. If it is then execute Application.ShowDisplay ("popup") and set the tag back to zero
I can't get it working. So I'm trying more and more basic things to troubleshoot where I'm going wrong, and well, I can't get anything to work!
Here's my code so far.
Public WithEvents TestTags As TagGroup
Public Sub Display_AnimationStart()
Dim TestLogicInt As Integer
If TestTags Is Nothing Then
Set TestTags = Application.CreateTagGroup(Me.AreaName, 1000)
TestTags.Add "{Utilities\TestBool}"
End If
TestTags.Item("{Utilities\TestBool}").Value = False
Elements.Item("text1").Caption = TestLogicInt
End Sub
Private Sub TestTags_Change(ByVal TagNames As IGOMStringList)
TestLogicInt = TestLogicInt + 1
Elements.Item("text1").Caption = TestLogicInt
Application.ShowDisplay ("popup")
End Sub
I'm trying to be really simple about it. On my test display I have a button, a numeric display, and some text. The button toggles the TestBool tag (which is a tag not tied to the PLC, just a local HMI tag for testing). Then my numeric display shows the state of the TestBool tag. When I go to test display, clicking the button makes the numeric display change from 1 to 0 and back again, so I know the tag is changing. Then, in the tag change sub, I increment 1 and set the text to display the current count. So if this was working, every time I clicked the button, the number shown in the text box would increment, but it doesn't. It increments once when the display first starts, and then stays at 1 from then on.
One other thing to note is that I'm doing all this from the development environment. But I have tied the alarm and event server and the HMI server to my local machine, and they're running happily (in grace mode). I know that I won't be able to actually call a display from the development environment, but if I can get it as far as an error saying "you can't do that in development environment", then I know my logic at least works