01-02-2024 12:02 AM
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
Solved! Go to Solution.
01-02-2024 12:53 AM
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?
01-02-2024 06:32 AM
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).
01-02-2024 11:24 AM
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.
01-03-2024 01:23 AM
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.
01-03-2024 10:08 AM
@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.
01-03-2024 06:53 PM
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.