LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Panel locks - events and multithreads or what?

Hello,

When an event occurs my front panel locks. On my front panel I have a XY-chart and alot of knows and buttons. What I want to do is to use a menu item to save and load files, a file dialog should pop up. This seams impossible. It always results in one of the following:

1. Front panel locks.
2. Front panel works but no sign of the file dialog.
3. You can call the file dialog once (this is if I put the mane outsude the while loop).

I've found alot of questions about this is your forums but I never once saw a sollution for it. Can I run the file dialog as a seperate thread? Events seam to lock the panel (not just the menu item calls - but all events). How do I create a thread? I don't know what to do.

Reg
ards,

/Thomas
0 Kudos
Message 1 of 4
(2,628 Views)
Hi,

When the popup is called, LV cannot continue it's while loop, because it
needs a value from the dialog. This is the same for every function that
takes a long time to finish ( a 5000 wait will hold up the loop 5 seconds, a
dialog will hold up until it's done).

Trick is to do the windows popups in a seperate loop. The difficult part is
to synchronise the two loops. But this can be done;

Make a parallel while loop, with a case in it. The case is wired to a local
boolean "file popup".

If file popup is true, the dialog apreas (note how the other loop is still
running properlly). The "file popup" is set to false.

The main loop sets the "file popup" to true, when the event happens.

When the dialog is done, a boolean indicator "file to load" is set,
as well
as an indicator for the file name.

The main program has a case in it. When "file to load" is true, it resets
"file to load", and does the loading stuff.

Regards,

Wiebe.



"Tobe" wrote in message
news:5065000000080000002C570000-1027480788000@exchange.ni.com...
> Hello,
>
> When an event occurs my front panel locks. On my front panel I have a
> XY-chart and alot of knows and buttons. What I want to do is to use a
> menu item to save and load files, a file dialog should pop up. This
> seams impossible. It always results in one of the following:
>
> 1. Front panel locks.
> 2. Front panel works but no sign of the file dialog.
> 3. You can call the file dialog once (this is if I put the mane
> outsude the while loop).
>
> I've found alot of questions about this is your forums but I never
> once saw a sollution for it. Can I run the file dialog as a seperate
> thread? Events seam to lock the panel (not just the menu item calls -
> but all events). How do I create a th
read? I don't know what to do.
>
> Regards,
>
> /Thomas
Message 2 of 4
(2,628 Views)
Thanks for your answer. I find something very strange though.
In my main loop I have a stop button, if I connect this stop button to the "Stop if true" terminal in my second while loop, only the main loop executes and when I click on the stop button the second while loop runs once before the program ends.
I'm a newbie to LabView but shouldnt it be possible to connect two while loop to the same stop button and run them BOTH!?

Regards,

/Thomas
0 Kudos
Message 3 of 4
(2,628 Views)
The wire to the second while loop does not have a value, until the first one
quits.

What you've done is synchronised the second while loop to wait for the first
one to quit.

Use the debug mode (light bulb) to get an illustration of this happening.

Instead, use a Local variable of the button. Be carefull, if the button is
set to a latch action, the Local cannot be used.

Also, put a "Waitm (ms)" in both loops (e.g. 50 ms), the code will run
better.

Regards,

Wiebe.


"Tobe" wrote in message
news:506500000005000000A1960000-1027480788000@exchange.ni.com...
> Thanks for your answer. I find something very strange though.
> In my main loop I have a stop button, if I connect this stop button to
> the "Stop if true" terminal in m
y second while loop, only the main
> loop executes and when I click on the stop button the second while
> loop runs once before the program ends.
> I'm a newbie to LabView but shouldnt it be possible to connect two
> while loop to the same stop button and run them BOTH!?
>
> Regards,
>
> /Thomas
0 Kudos
Message 4 of 4
(2,628 Views)