LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

frontmost property

I am fighting this one!  Some basic things that I need to occur.

1.Need to be able to call a subvi from a main vi (which takes up the entire screen), respond to events in the subvi. Then when the main vi is clicked on(without closing subVI), be able to respond to events on the main VI.

2. Have the main vi be able to be selected, basically all this means is that I cant make the subvi modal.

3. When the close/stop button is pressed on the subvi it must close.

4. Need to have the subvi opened by responding to an event, because main takes the entire screen once the subvi is initially open I need it to be brought to the front.  Property isFrontmost is not working.

The frontpanelstates example is great for showing the ways at which a subvi can be manipulated, but it doesn't allow any events/control of the subvi and meet all my needs as stated above.

Any help is appreciated.  Thanks ladies and gents!

LV 7.1 on XP

 

0 Kudos
Message 1 of 5
(2,908 Views)
Sorry heres part 2 of the attachment
0 Kudos
Message 2 of 5
(2,904 Views)

Interesting!

If I use the fp open and fp run I get the same functionality as just using the vi icon to run the subvi, However, If I use the "Old FP Open"  I can switch back and forth between the main and the subvi, things work....almost ....as needed.  When I press cancel on the subvi when I try to bring it to the front I get an error "Error 1000 occurred at invoke node"  possible reason, the VI is not in a state compatible with this operation.  I'm closer but not there!

0 Kudos
Message 3 of 5
(2,897 Views)

This isn't the most desirable solution, but it definitely works: When the subVI finishes executing, write a True value to a global boolean which you poll in a while loop in the top-level VI. When the top-level VI reads a True value, it closes the front panel of the subVI by setting the FP Window.Open property to false.

Combining this idea with your latter idea allows for a popup subVI that doesn't halt the execution of the top-level VI, but can still be closed by the top-level VI after it finishes executing.

I'm  still looking for a more robust and elegant way to do this, namely one based on events, but there is an inherint difficulty in responding to events from asynchronous VIs. This will work for now, but beware overuse of global variables!

Jarrod S.
National Instruments
0 Kudos
Message 4 of 5
(2,879 Views)
This is a vi that I threw together using vi server. It is probably not the most elegant way or the most professional way but it works as intended. I could not open your original vi because I only have 7.0 so if you did it this way and it did not work I appologize.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 5 of 5
(2,865 Views)