LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

weird behavior calling subvi (Help)

Here are two simple vis, one is main vi, the other one is a sub vi. Actually, the both do nothing, main vi has two buttons, one is stop button, the other one is call subvi button. subvi has only one button, stop button.
 
What I did is:
 
1. After the executable file (Test.exe) is generated, run it.
 
2. now if I click "Run SubVI" button, the program works fine, it goes to sub VI.
 
3. However, at this time, assume if there is another application like "notepad" task is running, when I click the notepad icon on the window's task bar, notepad is opened,
 
4. then, after I click the "Test" Icon on the task bar, the program goes to the main program, not the subvi program as I expect. any hint will be appreciated. Thanks.
 
I use winxp, LV 7.1
 
 
Download All
0 Kudos
Message 1 of 16
(3,499 Views)
hi Test,
 
there is absolutely NO PROBLEM at all with the execution of the VIs.
 
when I went to a Notepad application & returned back to LV, it came to Sub VI, if that was running currently or it came to Main VI, if that was running currently. Maybe problem with Ur system settings I think.
 
Regards,
Partha.
- Partha ( CLD until Oct 2024 🙂 )
Message 2 of 16
(3,481 Views)
hi,
 
there is absolutely NO PROBLEM at all with the execution of the VIs. Smiley Very Happy
 
when I went to a Notepad application & returned back to LV, it came to Sub VI, if that was running currently or it came to Main VI, if that was running currently. Maybe problem with Ur system settings I think.
 
Regards,
Partha.
- Partha ( CLD until Oct 2024 🙂 )
Message 3 of 16
(3,479 Views)
hi,
 
there is absolutely NO PROBLEM at all with the execution of the VIs. Smiley Very Happy
 
when I went to a Notepad application & returned back to LV, it came to Sub VI, if that was running currently or it came to Main VI, if that was running currently. Maybe problem with Ur system settings I think.
 
Regards,
Partha.
- Partha ( CLD until Oct 2024 🙂 )
Message 4 of 16
(3,478 Views)
 
Try this one. Please don't change the vi properity setting.  This bug is really hard to catch.
 
1. generate Test.exe.
2. open notepad.
3. right click "Start", go to "expore", left click it. now we have two task, explore and notpad.
4. run Test.exe.
5. click " Run SubVI".
6. click "explore", changes slection ( select one file), then click notepad icon. repeat several times.
7. click Test icon.
8. Program stroke.
 
 
Thanks.
 
 
 
 
Download All
0 Kudos
Message 5 of 16
(3,473 Views)
Put a small (even 0 msec will do) wait inside each of your while loops. without a wait, the loops will execute as fast as possible and it will make it difficult for the OS to perform it's tasks and for your VI to respond to user input.
0 Kudos
Message 6 of 16
(3,450 Views)

I add the wait time in each loop, the same thing happened.

I really doubt when the main vi call sub vi, the handle is still in main vi, at this time, when applications are changed front and back, the program is stroked there. The reaon is that the front panel is the main VI's front panel, but the diagram running is subvi's diagram.

Anyway, thanks

 

0 Kudos
Message 7 of 16
(3,442 Views)
I built the exe and as the other's said, I see no problem. "Stroked" is not a programming term that I recognize. Explain exactly what the problem is that you are seeing.
0 Kudos
Message 8 of 16
(3,436 Views)

Thanks, Dennis.

As I said, it is really hard to catch this bug. I test it on more than 7 different setting Dell PC machines, the same problem happens.

Cause we have two loop here, one is in main.vi, one is in sub.vi, does not matter have wait time or not.

1. When you click Run SubVI button, the program goes to subvi, works fine. (I admit this)

2. At this time, if you change among different applications (notpad, explore,...) when you go back, the program stop in the main vi front page with two button there (not in sub vi which has only one button on GUI).

Repeat 1 and 2 several time, the bug is generated.

I am not sure if this is clear to you.  I also found if I change the sub vi windows behaviour to Model or Float, the bug can be fixed. But, I don't want to do that. What I try to do is set up sub vi property (windows behaviour as Default) and solve this bug.

 

 

 

0 Kudos
Message 9 of 16
(3,433 Views)
I still don't see any bug. If you click the run subVI button, the subVI is running, the main VI's panel is hidden by the subVI, and even if it was visible, you couldn't click on any of the main VI's buttons because of the way you've written your program.
0 Kudos
Message 10 of 16
(3,423 Views)