LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Frontmost Block Diagram?

Is there a way to determine which block diagram is frontmost?  Basically the same idea as the FP.IsFrontmost property for the block diagram instead of the front panel.

0 Kudos
Message 1 of 16
(7,369 Views)

If you don't mind using the Windows API you can call its functions to determine the top window.

If you want a partial solution, there is an Application event called VI Activation. I believe this fires whenever you enter the FP or BD of a VI (and returns its reference), but:

a. I think it's private.

b. It means you have to run the event structure in a loop to get the current VI. This is actually probably not a problem when you're doing scripting work.


___________________
Try to take over the world!
0 Kudos
Message 2 of 16
(3,741 Views)

There must be some way to do it because the Navigation Window (aka the bird's eye view) changes depending upon which VI is frontmost, and the Nav window is written entirely in G. I'll ask the developer of that feature to comment here.

0 Kudos
Message 3 of 16
(3,741 Views)

I got it to work using the Windows API.  Thanks for the suggestion, tst!

I am interested though in the G only solution...

0 Kudos
Message 4 of 16
(3,741 Views)

Did you try the VI Activation event? I'm fairly sure that's what the navigation window uses, because it's open all the time when you use it.


___________________
Try to take over the world!
0 Kudos
Message 5 of 16
(3,741 Views)

I'll look into it.  I got the Win API appoach to work and was satisfied... but now I'm curious!

0 Kudos
Message 6 of 16
(3,741 Views)

can the ObjHighlight method do this if you pass the ref of the diagram?

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 16
(3,741 Views)

I would recommend that you check out the "Scripting Springboard" vi attached to this post

http://decibel.ni.com/content/groups/labview-apis/blog/2009/06/15/getting-started-automating-development-through-lv-scripting

It shows how to utilize the VI Activation event to very easily have the "Frontmost BD" reference at your disposal whenever you want it.

The basic idea is that you need a process sitting in the background just watching that event and then keeping the necesssary references stored within some mechanism (Queue, Shift Register, something that rhymes with Schmobal Schmeriable that I won't dare say here for fear of being flamed)

But that technique has worked for me for many years wrt scripting.

0 Kudos
Message 8 of 16
(3,741 Views)

Hi David,

there's a property Application.VIofTopMostDiagram that does exactly what you need.

TopBD.png

GCentral ChampionCLA
0 Kudos
Message 9 of 16
(3,741 Views)

The VI Activation event is exactly what I was looking for!  So, is there another way to get to that event other than copying it from an existing VI?  Thanks again for the help!

0 Kudos
Message 10 of 16
(3,741 Views)