LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Move a group of windows front

Solved!
Go to solution

Hello,

 

I have two groups of windows,

 

Group1: Main1.vi, sub1.vi, sub2.vi

Group2: Main2.vi, sub1.vi, sub2.vi

 

Main vi calls sub vis.
When the mouse clicks on any vi in Group 1, all three vis in Group 1 move forward. Similarly, when the mouse clicks on any vi in Group 2, all three vis in Group 2 move forward.
Throughout the entire process, the sub vi is in front of its main vi.

 

I tried SetWindowPos in the user32.dll, but I didn't get the ideal answer. So, is there any way to do this?

 

Thanks

Henry

0 Kudos
Message 1 of 7
(814 Views)

Hi Henry,

 


@henry_2020 wrote:

I have two groups of windows,

 

Group1: Main1.vi, sub1.vi, sub2.vi

Group2: Main2.vi, sub1.vi, sub2.vi

 

Main vi calls sub vis.
When the mouse clicks on any vi in Group 1, all three vis in Group 1 move forward. Similarly, when the mouse clicks on any vi in Group 2, all three vis in Group 2 move forward.
Throughout the entire process, the sub vi is in front of its main vi.

 

I tried SetWindowPos in the user32.dll, but I didn't get the ideal answer. So, is there any way to do this?


  • Create an executable from each Main VI.
  • Set the subVIs to modal or floating.

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(793 Views)
Solution
Accepted by topic author henry_2020

I believe you can also use the things in the attached snippet to do this. You could probably have a VI running with the event to see when your specific windows activates and use the IsFrontmost property or the window handle to bring the VIs to the front. I would suggest testing in an EXE, etc., to make sure this actually works. I'm guessing you might also need to handle duplicate window activations from when you bring the windows to the front (e.g. by ignoring activations which come immediately after other activations).

 

Example_VI.png

 

 


___________________
Try to take over the world!
0 Kudos
Message 3 of 7
(755 Views)

Seems like a questionable UI as well as herding cats in the code.

 

Since the subVIs are apparently always in front of their main VI, maybe you could just have the tho main VIs and their respective subVIs in subpanels.

0 Kudos
Message 4 of 7
(728 Views)

thank you all,

I made a demo based on tst's answer, which is basically what I want. Although it may not be very direct.

Download All
0 Kudos
Message 5 of 7
(688 Views)

@henry_2020 wrote:

I made a demo based on tst's answer, which is basically what I want. Although it may not be very direct.


In my casual testing, it only moves the subs to the front when one of the mains is clicked. This seems different than the original problem description.

0 Kudos
Message 6 of 7
(662 Views)

In the video, you can see that when the mouse clicks on Main2, Main2 and Main2Sub3 move to the front, and Main2Sub3 is in front of Main2.

0 Kudos
Message 7 of 7
(630 Views)