Is there an easy way to programmatically get the end time of the display? We want to show it in the top of our displays. The solution we have found is ugly but it works...
We have a hidden trend on every display to guarantee the users can scroll time. In the trend's OnChangeTimeRange (or whatever it's called) event, we grab the end time and display it in a text symbol. Trouble is, most of the time the end time is Current Time and we need the displayed time to show that, updating every few seconds.
So in the display's OnDataUpdate() handler, we get the trend's current time settings (eg *-1d and *) and pass them back into it's SetStartAndEndtime() method. This then triggers the OnChangeTimeRange handler so we can grab the end time and update the text symbol. This seems to work but, as I say, it is ugly! For one thing, I believe it may make the trend go back to PI for its historical data so we will have to ensure it looks at a quiet tag like Sinuisoid.
In case it makes any difference, this must also work in ActiveView.
Private Sub Display_DataUpdate() Dim ptfStart As New PITimeFormat Dim ptfEnd As New PITimeFormat ptfStart.InputString = ThisDisplay.StartTime ptfEnd.InputString = ThisDisplay.EndTime Text1.Contents = ptfStart.LocalDate Text2.Contents = ptfEnd.LocalDate End Sub
note that you have to add a reference to the PITimeServer 1.1 Type Library to use the PITimeFormat.