Is there a way to get the monitor number of the monitor the front panel currently resides on? I have multiple monitor setups where a TE will arrange several apps based on the test. I want those apps to maximize to the monitor they are on, not to the default monitor or to a monitor known at edit time. There are properties to set the monitor and maximize it but I can't find any that would tell what monitor the FP is currently on.
You just need to right click the property node and select "Change to read". Or, you might not have found the correct property.
Ok, I tried that and it does give me the correct monitor number. I had done that before but didn't probe the wire, I had fed it directly into a maximize FP invoke but that keeps putting the FP on the primary screen, not the screen it's on.
The invoke node you used changes the vi properties. The same as in File / VI Properties / Window Run-Time Position, this will control where the front panel opens the next time.
Us the property node, and set Front Panel Window / State. That should get you what you want.
The code snippet failed. And it's got odd behavior. I can run the vi several times and each time the FP shows up on a different monitor. The prop node gives me the correct Windows monitor number (in my case it's on monitor 3), but feeding that into the invoke node results in this odd behavior of the FP coming up on different screens each time.
Ok, I see now that the FP.monitor prop node gives the index of the last monitor the FP was on in run mode, not edit mode. I was trying to get it to open on the monitor it's on when the run arrow was clicked, not the last monitor it ran on.
I think I understand you now... When the TE opens example.vi, it should always appear maximized on a certain monitor regardless of where and how it was running, or closed.
Try this - in edit mode, maximize your vi to monitor 3, then File / Save. Move your vi to monitor 2, then close it. Open your vi, it should be maximized on monitor 3, (or wherever it was at the last saved).
Make sure you edit the vi properties to Window Run - Time Position to "unchanged" or the FP might move when you run it.
Well, sorta. The idea is that the TE may move the vi around to a different monitor, then run it. When it's run, the idea is that it maximizes itself on the screen the TE moved it to, regardless if the TE max'd it or not and regardless of the screen it was last run on or where it was when it was last saved. We run a lot of tests with many FP's and they get rearranged a lot because the tests change a lot...sometimes many changes a day. I was just hoping to make it a little nicer for the TE if they just had to move the window and it auto max'd in that window when run.
If that is what you want, then the property node will work.
Set the property "Front Panel Window: State" to "Maximized" (making sure it executes at the beginning of your code).
Also, as I mentioned before, check the vi properties "Window Run Time Position" to make sure you aren't moving the window before the property node gets to act.