LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disable main vi front panel

Hi,

 

I have a main vi and a subvi which is opened from the main vi. Main vi is maximized (takes all screen) and subvi is small one. My desired behavior is: the main vi opens the subvi, main vi must be visible in the background, but it must not collect any event (e.g.. If button on the main vi is clicked when the sub vi is opened).

I know that can be achieved with setting the subvi to modal, however I do not want to do that (because subvi opens also some other windows, ...).

Is there any other way to prevent the main vi to collect events while the subvi is opened (e.g. To disable whole front panel at once)?

 

Thanks!

0 Kudos
Message 1 of 7
(1,257 Views)

Hi,

I wonder why you are afraid of using modal sub-vi.

Your sub-vi can open another sub-vi which would have modal property without any problem.

 

If you really hate using modal property, I can suggest one method.

 

When your subvi starts running, set a global boolean variable - let's call it evFlag. Clear evFlag when you close that sub-vi.

And make your event handler of main vi not respond on the specified event, i.e. in every cases of the event, open a case structure which is switched by evFlag. Place your handler inside the FALSE case.

 

Anyway, I think he methode above is a very foolish solution.

 

Regards.

 

0 Kudos
Message 2 of 7
(1,245 Views)

I can use modal property, because then some other features in the subvi won't work (I have several subvis in the subvi).

 

Your method could work (but I think it's not a good approach) if you have one or two such windows, but I have 50 of them and I have to do that in each of them 😞

0 Kudos
Message 3 of 7
(1,239 Views)
You can get the Controls[] property and set all to disabled in the main vi.
/Y
G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 7
(1,230 Views)

I'm aware of this solution, however I hope there is a better solution 🙂

Thanks anyway!

0 Kudos
Message 5 of 7
(1,223 Views)

Hi,

 

As an alternative to a modal dialog, you can use the VI Server "version" of the modal functionality, by using the FP.IsFrontmost VI property.

How Do I Configure My LabVIEW Application Window to Always Be on Top?

 

Alternatively, you can programmatically "take" focus from your subVI once, when it launces by using the Application / Bring To Front invoke method.

BringToFront.png

 

You can also programmatically give the Focus to the subVI from the main VI, that is a bit more compicated as you need a VI reference to your SubVI (See Calling a VI by Reference). Then you can for example use FP.IsFrontmost again.

 

PF.IsFrontmost.png

Best Regards,
T Simon
National Instruments
Applications Engineer
Certified LabVIEW Developer - Certified TestStand Architect
0 Kudos
Message 6 of 7
(1,168 Views)

Hi Simon,

 

with you solutions the window will be always on top, but I can still click in "bottom" window and an event will be generated there.

0 Kudos
Message 7 of 7
(909 Views)