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

Order of when displays last viewed Options · View
jc113883
#1 Posted : Friday, August 05, 2011 2:44:38 PM
Rank: Member
Groups: Member

Joined: 10/7/2009
Posts: 14
Hello,

Is there a way of getting the order of when displays were last viewed? For example, when you close a display, the previous display that you had been viewing will now become the active display. Can I determine which display that will be?

Graeme.
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 : Wednesday, August 10, 2011 12:41:48 AM
Rank: Member
Groups: Member

Joined: 7/5/2010
Posts: 27
Location: Texas
Well, you'd think that should be something that's exposed in the ProcessBook object model, but it hasn't turned up in any of my poking around on the Application, Displays or Display object properties and methods.

Maybe someone else will be able to help you, but if you really need this and don't want to wait (if it's NOT in the object model, you could have a long wait..) then you'll probably have to create a way to keep track of that.

You could start with a VBA FIFO stack class - a net search should turn up a bunch of them. You'll also need a ProcessBook Application events class - see the ProcessBook help file for 'Example for Application ModeChange Events' for how to set one up - here's another go-by:

Code:

Public WithEvents test As Application


Private Sub test_AfterModeChange(ByVal bRunMode As Boolean)

    Debug.Print "AfterModeChanged"

End Sub


Private Sub test_BeforeModeChange(bCancel As Boolean)

    Debug.Print "BeforeModeChanged"

End Sub

Private Sub test_DisplayActivate(ByVal aDisplay As Display)

    Debug.Print "Activated: ", aDisplay.Path


End Sub


Private Sub test_DisplayDeactivate(ByVal aDisplay As Display)

    Debug.Print "Deactivated: ", aDisplay.Path


End Sub

'This code is in the Display Object:
'
'Dim app As cApp
'
'
'Private Sub Display_Open()
'
'   Set app = New cApp
'
'   Set app.test = Application
'
'End Sub



Set that up and play with first two .pdi files and then more to get an understanding of how the events occur (you'll get a Deactivate followed by an Activate if you just click on different .pdi's - and don't forget to check what happens when you open a new .pdi and select, then close a .pdi that's already open).

When you get all that down, then you can start figuring out when to do the Poke and/or Pop to your FIFO stack. Peek will let you see the next .pdi down in the stack, and that will be (as I understand it) what you are looking for.

There are going to be some fun complications that could arise from programmatically closing a .pdi - that might correspond to needing to remove a .pdi from somewhere other than the top of the stack. Either you'll need a stack that allows that, or you might get by with doing a double pop if the topmost .pdi in the stack isn't among the .pdi files that are in the Displays collection.

Sure hope someone comes up with an object model solution or something more elegant than what I described.

If you do roll your own, please post back here what you came up with!

James
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.