Code for actual trend display:
Private Sub btn30Min_Released()
On Error Resume Next
Trend_Line.XAxis.TimeSpan = 30 * 60
End Sub
Private Sub btn2Hrs_Released()
On Error Resume Next
Trend_Line.XAxis.TimeSpan = 2 * 60 * 60
End Sub
Private Sub Display_AnimationStart()
On Error GoTo ErrHandler
Trend.LoadTemplate ("Last_View")
ErrHandler:
End Sub
Private Sub Display_BeforeAnimationStop()
On Error GoTo ErrHandler
Trend.SaveTemplate ("Last_View")
ErrHandler:
End Sub
-------------------------------------------------------
Pen Selector Code:
Note that all buttons on pen-selector popup windows are just plain buttons. Give them a name, but they have no actions. Set as VBA control.
'On animation start of the popup window:
'Note that popup needs to find the window with the trend on it
'General
Dim oDS As Displays
Dim oTrendDisp As Display
Private Sub Display_AnimationStart()
On Error GoTo ErrHandler
Set oDS = LoadedDisplays
Set oTrendDisp = oDS.Item("history1")
SetPenStates oTrendDisp.Trend.Pens.Item(1), PB_ToggleP01
SetPenStates oTrendDisp.Trend.Pens.Item(2), PB_ToggleP02
'.....
Exit Sub
ErrHandler:
LogDiagnosticsMessage Err.Description & " Pensel.gfx Error", ftDiagSeverityError, ftDiagAudienceEngineer
End Sub
'Set pen states pulls info from the actual trend pen settings:
Private Sub SetPenStates(thePen As Pen, thePB As Button)
On Error GoTo ErrHandler
thePB.Caption = thePen.Description
If thePen.Visible Then
thePB.BackColor = 32768
thePB.ForeColor = 16777215
Else
thePB.BackColor = 8421504
thePB.ForeColor = 0
End If
Exit Sub
ErrHandler:
LogDiagnosticsMessage Err.Description & " Pensel.gfx Error", ftDiagSeverityError, ftDiagAudienceEngineer
End Sub
' Pressing a Pen Toggle Button on the popup calls the toggle states function for the associated pen:
Private Sub PB_ToggleP01_Released()
On Error GoTo ErrHandler
TogglePen oTrendDisp.Trend.Pens.Item(1), PB_ToggleP01
Exit Sub
ErrHandler:
LogDiagnosticsMessage Err.Description & " Pensel.gfx Pen Index Error", ftDiagSeverityError, ftDiagAudienceEngineer
End Sub
' Toggle the actual pen passed in and set the button state:
Private Sub TogglePen(thePen As Pen, thePB As Button)
On Error GoTo ErrHandler
If thePen.Visible Then
thePen.Visible = False
thePB.BackColor = 8421504
thePB.ForeColor = 0
Else: thePen.Visible = True
thePB.BackColor = 32768
thePB.ForeColor = 16777215
End If
Exit Sub
ErrHandler:
LogDiagnosticsMessage Err.Description & " Pensel.gfx Error", ftDiagSeverityError, ftDiagAudienceEngineer
End Sub