07-10-2013 06:48 AM - edited 07-10-2013 06:49 AM
i have included a VI to explain my problem that's how my application is build only then a lil more complicated but i left it to the basics since i can't share my full VI. The case is that if you press start the program should start and load a movie however if you either go to the other tab or when you click 'start' again the program should close the IMAQ file i just get strangled by the fact that i have no clue which loop to stop and where to close the video. Help would be greatly appreciated
07-12-2013 04:51 AM
Hello Rinus,
According to what you've written, finding the Vis is not really a problem.
The issue is rather in how to make everything happen at the right moment in time.
For this I would advise you to use one of the Design Patterns in LV.
Are you familiar with some Design Patterns in LV?
If not, then I would advise you to first read up on the following Design Patterns:
http://www.ni.com/white-paper/7605/en/
This will help you understand how you can handle certain actions one after the other.
If this does not help you along or still leaves you confused about how to program everything, then please let me know so that I can help you.
07-12-2013 05:08 AM
ah i might have made the title wrong i meant more i have a problem with finding where in the while loop i should close the video to ensure i can open that same video once i go to the next tab or make the start button false...
07-12-2013 07:07 AM
Hello Rinus,
I think having two parallel while loops in this case doesn't seem necessary (and should be avoided).
As you said, you want to close/stop the video "stream" in the first tab when you open the second Tab (and probably also the other way around).
This would mean that you'll have to use a "framework" that allows you to have several states and can detect a change between tabs, correct?
The easiest way to implement this is by using a Design Pattern as starting point.
Can you make a flow chart that fully explains what the requirements are of your program?
This will allow you to choose the right design pattern.
If you are not comfortable with flowcharts, then a more complete description of the requirements would allow me better to guide you to an appropriate "framework".
Based on the current requirements a simple state machine could maybe do the trick, but this of course depends on the additional (not yet mentioned) requirements you might have.
I'm asking this especially because you refer to a "more complicated" top level application.