Good morning, NI LabVIEW community.
I am working on a vi that displays a message to the user and then closes after five seconds. When I run the vi itself it works fine, but when it is inserted into another vi the text does not display when the vi runs for the first time. Anytime after that the text will display though.
I've searched for help and fiddled around with the wiring, but I'm still having this issue. Maybe it is just not possible to do. ![]()
Any help will be appreciated!
Solved! Go to Solution.
You have a greedy loop hogging the cpu and preventing the update to the indicator! Toss any kind of delay in the while loop.
Woohoo! That did it, apok!
Thanks for the quick response!
Jeff, I understand, but there is not a delay in the loop. Should I build this vi without a loop?
Your loop really isn't doing much other than providing a very fast running, CPU hogging mechanism to put a 5 second dealy between the FP Open and FP Close.
If replaced the while loop with a single frame sequence structure, then put a Wait (msec) function in there with the 5000 wired to it, it will effectively do the same thing without burning CPU cycles.
@evannfernandez wrote:
Woohoo! That did it, apok!
Thanks for the quick response!
Jeff, I understand, but there is not a delay in the loop. Should I build this vi without a loop?
There are tons of ways to built that vi that do not have greedy loops
To be consistant with personal design guidelines I have mentioned around here from time to time, I'd choose something very close to this:
RavensFan, thank you for the reply and clear explanation. I have implemented your suggestion.
It still requires a property node for the message set to "visible", but that isn't a problem.
Ah, I see, Jeff. I appreciate you taking the time to post that.
I'll give it a try.
@JÞB wrote:
You have a greedy loop hogging the cpu and preventing the update to the indicator! Toss any kind of delay in the while loop.
i didnt realize that....if you put in the "wait(ms)" in the loop, it would work!
@apok wrote:
@JÞB wrote:
You have a greedy loop hogging the cpu and preventing the update to the indicator! Toss any kind of delay in the while loop.
i didnt realize that....if you put in the "wait(ms)" in the loop, it would work!
Easy to miss and a subtle point about busted dataflow. Or I would have left the thread in your more than capable hands. Forcing a redraw with a property node also worked I assume but, simply masked the real problem and without datadependancy between the greedy loop and the p-node you are left at the mercy of the compiler as to when exactly that redraw is requested.