YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Trend Arrow Event Options · View
tilak
#1 Posted : Friday, August 26, 2011 9:26:41 PM
Rank: Newbie
Groups: Member

Joined: 8/26/2011
Posts: 8
Location: California
Hello,
I'm trying to figure out what event is triggered by pressing on the arrows that move the start & end time at the bottom of a trend on a process book display. One event that is triggered is the

Private Sub Trend1_TimeRangeChange(ByVal StartTime As String, ByVal EndTime As String)
End Sub

but that event is tiggered by many things. I am thinking that an event is generated when one of those arrows are pressed, which then goes and calls the above sub (ofc I could be totally wrong).

Here is what I am trying to do:
I have a few Date and Time Picker objects in the display, which I use to allow the end user to easily change the start/end date/time. Upon opening the display, they are set to reflect the trend's start and end time. If the user changes one of these objects, the trend changes it's start/end time as well. However, if the user presses the right/left arrows at the bottom of the trend to change the start/end time, this is not reflected in the Date and Time pickers.
I tried changing their values in the above event, but that event is called so often that not only does it greatly slow the program down, but also changes it unnecessarily.

I hope I've expressed myself clearly.
Thanks!
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
jhcoxx
#2 Posted : Monday, August 29, 2011 4:09:54 AM
Rank: Member
Groups: Member

Joined: 7/5/2010
Posts: 27
Location: Texas
You're probably right about there being some event that is being triggered by the click on the button - in fact if you just hover the mouse over one of the arrows, it highlights - which indicates some event is firing. But just because an event is firing, it doesn't mean that the OSI developers have exposed the event so that you can use it.

Two possibilities come to mind - neither particularily attractive.

The most bullet-proof one is to create left and right arrows (from the Symbol Library, perhaps or a Polygon), enable scripting for them, position them so they cover the arrows on the trend and then group your arrows and the trend. You then will have to use your arrow's Click event to both update your Date and Time pickers. You'll also have to calculate the new start and end times and then pass them to the trend by calling the trend's

Trend1_TimeRangeChange(ByVal StartTime As String, ByVal EndTime As String)

with the appropriate time strings.

Of course, it gets worse, in that you'll probably need to do the same for the 'revert button' and the zoom-in and zoom-out buttons on the trend.

The other possibility is to monitor the sequence of trend events and take appropriate actions re your Date and Time pickers. The events you do have access to that are relevant are the Trend's Click and TimeRangeChange events. A bit of testing shows that the TimeRangeChange event occurs BEFORE the Click event when the trend's right and left arrows are clicked.

Therefore, you could add to the TimeRangeChange event code to store the Now() in a global variable. Then in the trend's click event, you would add a test of that global value to see if the Click was preceeded by less than some small amount by a TimeRangeChange and if so, you would conclude that the Click event was associated with a user's click on the trend arrows and reset your pickers. You may need a high precision timer - Now() may not have adequate resolution (a search on VBA high resolution timer will turn one or more up). This approach would probably result in more picker updates than necessary, but fewer than if you used TimerangChange only.

Hope this helps - please be sure to tell us what you decided to do - even if it is something as low-tech as using Texts to display the start time and end times near the pickers (at least the user would have a local visual indicator of the times...)

James
tilak
#3 Posted : Friday, September 02, 2011 7:15:06 PM
Rank: Newbie
Groups: Member

Joined: 8/26/2011
Posts: 8
Location: California
Thanks for your reply. I intend to try the second of the two ideas you had, as soon as I get the time. Thanks again!
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.