ni.com checkout is currently experiencing issues.

Support teams are actively working on the resolution.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2 Sub Panels with images that load on button click. 2nd Sub won't load after 1st.

 So I have two sub panels on the front panel. I also have two buttons that are attached to the sub panels so that if a button is pressed its corresponding sub panel loads an image. This works fine. But then when I try the second button for the second sub panel, nothing happens and the button stays in the TRUE boolean position even though I've told it to go back to FALSE. This predicament seems to work vis-versa either way you choose which button to active which sub panel. Also I get an error at Invoke node sometimes when I try to load the second sub panel. 

 

A VI is attached. To test it just change the VI paths in both Case Structures to whatever picture you want to upload from your own library. So that's it. Thanks.

0 Kudos
Message 1 of 6
(2,572 Views)

Why do you have loops that run forever inside of case structures?  Those are why your VI seems to "freeze".  The outer loop cannot iterate until everything in it has completed.  Therefore your controls will not get read again until those inner loops complete, which will never happen.

 

Some recommendations:

1.  Use an Event Structure.

2.  Do not wait for your called VIs to complete (I assume that is what the loops with the waits are for).  As long as that VI's panel is open (in the Event Structure), you should be able to go ahead and close the VI reference and it will stay open.

3. Change your buttons to be Latch When Released.  This is the normal configuration for a button.  And with it being latched, you do not have to "reset" the button.  It will reset itself when the terminal is read.  Therefore, assuming you take my advice #1, put the buttons in its Value Change event case.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(2,532 Views)

Okay I will try that. I remember now that the event structure helped with a similar problem.

0 Kudos
Message 3 of 6
(2,511 Views)

So I did as you said and trimmed down my program, but now I'm running into a new problem. Now it gives me Error 1026 at the Sub Panel Invoke Node. I'm looking into it, but no solutions just yet. Here's my code.

0 Kudos
Message 4 of 6
(2,484 Views)

I think it's likely the reference to the VI is being closed before it is inserted into the subpanel and it probably throws an error when given a closed reference. Right now there is no dataflow enforcing the order of execution between the Insert VI and the Close Reference. Wire the error output of Insert VI into the error input of Close Reference to force them to execute in order.

 

Also, as a sidenote, I would recommend wiring up all your error terminals and handling them to check for errors in your program and respond appropriately. Automatic error handling is good for helping you catch errors during development if you have forgotten to wire them, but remember that it won't work in a built executable so to have good quality code it's important to deal with errors carefully.

0 Kudos
Message 5 of 6
(2,479 Views)

@ShogunOrta wrote:

So I did as you said and trimmed down my program, but now I'm running into a new problem. Now it gives me Error 1026 at the Sub Panel Invoke Node. I'm looking into it, but no solutions just yet. Here's my code.


Duplicate thread: https://forums.ni.com/t5/LabVIEW/Sub-Panel-VI-gives-me-Error-1036-at-Invoke-Node/m-p/3673822


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 6
(2,471 Views)