LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Opening picture assigned to a button

Hi guys,

 

as topic says, I want to assign opening of a picture to a button (so pressing the button will result in dialog box poping and asking user to chose a file). I want it to work while vi is running (so there are other thing done in the meantime). I tried many things with while loops and case loops, and results where that dialog poped up imediately when vi started to run, or dialogs keep on poping up despite file being chosen. Looked through the forums and I only found some more serious tasks solved. Anyone has an idea how to deal with it nicely? In the long run, i want this vi to open 3 different pictures and display them in loop in tim intervals.

 

As I'm semi-new to LabVIEW, i have another question - is my way of solving this issue correct. I know there is this File Path Control, but I have to fill it before running vi or if I don't do so, it will pop up just after the start of vi. I want to ask if "filling before run" is the idea behind LabVIEW, and it is common way of doing things, rather than leaving those things to be filled up while vi is running. Maybe my desire to have the file chosen while vi running is a bad assumption I had made about how this should be done.

 

My LV version is Student 2011

0 Kudos
Message 1 of 4
(2,357 Views)

You mean to say that the Dialog will be poped up for the user to select the file and also at the Background your code has to run?. If that is the case you can run the code in the other loop if you have not the one which has poped up a dialog.

 

 

2nd: The path control is used to set the path before you start running but the Path control will not pop up any dialog box unless its leads to a vi that needs the path and that vi has the option for poping the dialog box if the path is empty otherwise normal file function would through an error if the path is empty.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 4
(2,353 Views)

Take a look at the Producer-Consumer loop architecture, it should be suited to your needs.

 

It will allow you to pop up the dialog you require in the Producer loop, without interrupting the Consumer loop wherein you can execute background code.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 3 of 4
(2,349 Views)

Thanks for Your answers guys.

 

I made my mind and I'm going to make everything as simple as posible and will stick with the "fill before run" Path Control. Also this makes me change a concept of this vi a bit, and i think "doing something in the background while chosing files" won't be needed anymore, as the files are chosen before the vi run. I really appreciate the Producer-Consumer Structure suggestion, I'll remember to learn more about it for future works. I still don't know how to open a file via pressing a button while vi runs, but I see this might be a wrong way of doing things and will do it the other way.

0 Kudos
Message 4 of 4
(2,336 Views)