LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Reference to Open UIs

Solved!
Go to solution

Hi,

I want to create a drop-in sub.vi that can get a reference to any UI that opens up. The easiest way I can think of doing this is to use the property node current Vis in Memory, then open up their references using the VI name, and then check to see if the front panel is open. The issue I have is this will need to be polling and it seems like an inefficient way to proceed. Can anyone think of a better way to handle it?

 

Thanks,

Larry

0 Kudos
Message 1 of 5
(2,676 Views)

Check out the VI at vi.lib\Utility\allVIsInMemory.llb\VIMemory Get VIs in Memory.vi

 

It's going to make your life a lot easier.  It gets all VIs in memory, in all application instances, (that aren't in a private context) and has an input that is "Only VIs with Open FPs".  So just wire a constant TRUE and you're done.

 

This method will have you polling but just have it called in a timeout every second or 2 and you'll probably be fine.  This is for a UI so it doesn't need to update super fast.

 

One alternative you might enjoy that I haven't tested is to register for the Window Opened event for an application instance.  This is a private method and the help mentions how it is generated when a user opens a subVI.  It will return the application instance and VI ref for the VI opened.  Because it is private NI doesn't support it and using it in production application is hightly discouraged.

Message 2 of 5
(2,662 Views)

I coudn't find the Window Opened event, but I did try the hidden VI, Get VIs in Memory, and it works well. I just rediscovered the event "VI Activation". I need to see if it can make life any easier.

0 Kudos
Message 3 of 5
(2,649 Views)

@LJHerskowitz wrote:

I coudn't find the Window Opened event, 


As I said this is a private function and only NI are allowed to know about this super secret private special stuff.

0 Kudos
Message 4 of 5
(2,632 Views)
Solution
Accepted by LJHerskowitz

With VI Activation you would be half way there.  in 2013 VI Deactivation was added as a new scripting event so if you have a 2013 or later version you can do it all with a dynamic event


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 5
(2,607 Views)