LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Minimizing window

Does minimizing a VI generate an event? How can I capture this event?
As the user minimizes the main window, I want the other VIs to automatically minimize too.
0 Kudos
Message 1 of 2
(2,771 Views)
This is not an event that LabVIEW recognizes but you can capture it yourself using the Window Management VI's. A fairly simple way to do this would be to:

- Check the Title of the front panel using a VI property node.

- Wire this to Get Window Refnum.vi

- Pass the window refnum into a loop where Get Window Rectangle.vi is called every X milliseconds.

- Add a boolean shift register to the loop to keep track of whether the window is minimized or maximized. (Or an extra boolean control could be used with local variables if you wanted)

- Check to see if the results of Get Window Rectangle.vi are all negative.

- If the results are negative and the shift register is not set, execute the code to minimize your other windows (or call a user defined eve
nt to do so). Set the shift register or boolean variable (so the code to minimize other windows does not run every X milliseconds while the main window is minimized).

- If the results of Get Window Rectangle.vi are not negative, clear the shift register or boolean since the main window has been resized/maximized. This will let the VI know to minimize again once the results go negative.
Message 2 of 2
(2,771 Views)