10-11-2018 04:11 AM
Hi guys,
I am creating an utility in LV2018 to launch from the Tools menu, which will be able of centering FP window on the main screen and I encountered a problem. To focus on the problem only lets consider a following simple VI:
Assuming that I have a sample test2.vi in the temp dir, I can use attached code to modify position of the FP. I can also use invoke node to use fp.center method as well.
Problems appears when I want to invoke this functionality from the Tools menu. I put the VI to the C:\Program Files\National Instruments\LabVIEW 2018\project, restarted labview and opened it from the Tools menu. And the behavior is different - even though I am using reference to the file from hardcoded path to the blank VI.
After choosing VI from the tool bar, it opens test.vi which is being opened in NI.LV.Dialog application context (bottom left corner). Then when I run this VI instead of moving test2.vi FP to the upper left corner it creates a new test2.vi Front Panel in NI.LV.Dialog application context. So I have opened 2 separate front panels for the same file - I can see that they have the same file path in the VI settings.
But changes done to the NI.LV.Dialog instance of my VI don't propagate to the proper VI.
I just want to create a simple tool that will move my front panels to the center of primary screen. I haven't found anything that could help me and I am out of ideas.
-Do you have any idea how I can modify position of FP and save it succesfully from tools menu?
10-26-2018 06:54 AM
Why the utility, automatic centering not working for you?
Mike...
10-26-2018 01:06 PM
The behavior is expected: Tools run in a different application instance.
In your tool, use this to open a reference to the VI that launched the tool:
10-29-2018 07:07 AM
This is not exactly what I need, but gave me a hint I needed.
I have some logic, which lists VIs from the active project. So I do not want to center only one VI, but to do it in bulk for many files. Application reference is the key and I found what exactly I need to connect: