08-03-2005 11:11 AM
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
08-03-2005 11:13 AM
08-03-2005 12:32 PM
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!
08-04-2005 06:19 PM
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!
08-05-2005 09:52 AM