LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get current monitor of front panel

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. 

0 Kudos
Message 1 of 10
(4,257 Views)

You just need to right click the property node and select "Change to read". Or, you might not have found the correct property.

0 Kudos
Message 2 of 10
(4,248 Views)

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. 

 

image.png

0 Kudos
Message 3 of 10
(4,238 Views)

wrkcrww00:

I'm confused -- are you saying that the code snippet you showed worked, or that it failed?

 

Bob Schor

0 Kudos
Message 4 of 10
(4,230 Views)

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.

0 Kudos
Message 5 of 10
(4,226 Views)

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.

0 Kudos
Message 6 of 10
(4,221 Views)

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.

0 Kudos
Message 7 of 10
(4,216 Views)

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.

0 Kudos
Message 8 of 10
(4,203 Views)

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. 

0 Kudos
Message 9 of 10
(4,194 Views)

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.

0 Kudos
Message 10 of 10
(4,185 Views)