Jump to content

Sub VI called from event structure will not execute


Recommended Posts

Posted

Hello

I am running a few small tests with a type of sudo menu environment

The menu on the "main VI" has several bool buttons tied to an event structure

Inside of each event it simply calls the sub vi. The sub vi's are setup to open the front panel when called.

However, when the front panel of the sub VI opens and i try to use the functionality of the SUB VI i can hit buttons on the front panel but the action will not complete.

Obviously there is an issue with the sub vi's execution. Anyone can help me out with ideas? 

Thanks

 

 

Posted

You need to disable the 'Lock Panel (Defer Processing of UI) until event completes' option for the event case.

What's happening is that the event structure is locking the UI thread until all code inside of the case completes.

In your case you've got another UI coming up which you need to interact with for the case structure to complete.
A bit of a catch 22.

It might feel wrong that it's happening to you, but there are a variety of good cases that that feature exists and behaves as it does.

More commonly, for what you're trying to accomplish, people will make action loops which might receive a message to start open another panel instead of calling immediately from within the structure.

However that's a more complicated solution and if you're just trying to keep things simple, then just unclick that option and you'll be off to the races.

 

 

2019-04-28_2249.png

Posted
8 hours ago, Norm Kirchner said:

You need to disable the 'Lock Panel (Defer Processing of UI) until event completes' option for the event case.

What's happening is that the event structure is locking the UI thread until all code inside of the case completes.

In your case you've got another UI coming up which you need to interact with for the case structure to complete.
A bit of a catch 22.

It might feel wrong that it's happening to you, but there are a variety of good cases that that feature exists and behaves as it does.

More commonly, for what you're trying to accomplish, people will make action loops which might receive a message to start open another panel instead of calling immediately from within the structure.

However that's a more complicated solution and if you're just trying to keep things simple, then just unclick that option and you'll be off to the races.

 

 

2019-04-28_2249.png

Hi

Thank you for your reply

Unfortunately, disabling this feature did not solve the problem

I have added to simple pictures of the "main.vi" and the VI its called. As i said this is a very simple case. 

The bool.VI just simply turns on an LED on its front panel.

I can toggle the switch but the light will not come on when the VI opens

 

 

BD.PNG

bool_vi.PNG

Posted

Your event structure should be in a While loop. 

one of the events should generate a stop signal for the loop.

 

Posted (edited)

I have fixed the event structure by adding the while loop around it

The sub VI still will not run

I can flip the switch but the light will not turn on 

Edited by rscott9399
Posted
Just now, shoneill said:

Maybe post your VI?

Hi There

I posted a picture of it above

Thats all there is

Its just a test right now so its just main.vi and bool.vi

 

The main is the picture above with the event structure

and the bool.vi is the picture below.

its just a switch tied to an LED

 

Posted

A picture is not a VI.

You say you added a while loop. How? There are still a lot of variables which could go wrong. Post your code or we can't really help.

Posted

I expect to be able to click on the button on the main. Open the VI and use it ( whatever it does)

Then close the VI and go back to the main menu

It will be a learning tool for students

Each button will demonstrate a different feature of labview

bools, strings, etc etc

Posted (edited)

Your sub-VI does not have a loop. It will run once and once only per Event. If you leave the FP of the sub-VI open, you can click on the boolean when it is not running and it will be applied whenever it is run.

If you want your sub-VI to keep running, it also needs a while loop around it(either in the sub-VI itself or ourside). Just make sure you have a stop criterium for the loop.

If you go into the properties of the sub-VI you can also set the FP to open when called. This still won't make it keep running, but it will at least make sure the FP is opened.

Edited by shoneill
Posted

Also, I don't mean to be mean, but are you sure you're in the position to create code to teach people LabVIEW?

This isn't advanced LabVIEW. If this is the quality of material students will be using to learn LabVIEW it might be best not doing it at all.

Again, I'm not being mean, I'm being honest (and if anything I'm being diplomatic). Don't you have access to people who have (a lot) more experience in LabVIEW to help you out?

Posted

Thanks for your help

I will give your suggestions a try

I appreciate your concern. I am not teaching lab view

It is simply a test bench to develop and test different functions. This is just the main place to select different VI's you want to test is all.

Again, i appreciate your help and concerns. I fully agree, im not teaching anyone labview lol im a matlab guy truthfully 

  • Like 1
Posted
16 hours ago, rscott9399 said:

It is simply a test bench to develop and test different functions. This is just the main place to select different VI's you want to test is all.

Again, i appreciate your help and concerns. I fully agree, im not teaching anyone labview lol im a matlab guy truthfully 

No problems. I understood from the previous post you were teaching LabVIEW as opposed to using LabVIEW to teach something else.

All clear now. And either way, the community is always ready to help.

Posted
4 hours ago, shoneill said:

No problems. I understood from the previous post you were teaching LabVIEW as opposed to using LabVIEW to teach something else.

All clear now. And either way, the community is always ready to help.

Thank you guys very much

The only one im teaching is myself haha with the help of experts like you

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.