LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Enum in an Event Structure

Solved!
Go to solution

When I try to change an enum on my front panel with an event structure my labVIEW code locks up. I have to use the abort execution button to stop the program. Right now I'm just sending a picture. I'll need to isolate the event structure from a larger program to send you a vi.

0 Kudos
Message 1 of 12
(3,333 Views)

Hi M.,

 

just the image doesn't help to pin the problem...

 

Why do you write the new value to a local of the control?

Why is there a wait function in the loop?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 12
(3,329 Views)

Your post is too ambiguous to help. Please answer the following:

 

  • Attach your VI. (What is in the other event cases? is the code even running the shown loop when the lockup happens? What else is there? How long is the wait?)
  • What is "change"? Are you changing the value at runtime or editing the enum items ant edit time when this happens?
  • You cannot change an enum with an event structure, but you can change an enum in an event case using a local variable.

My guess is a deadlock due to the code executing something else and "lock front panel until event completes" is enabled. This probably hits at more serious architectural issues in the code, so please attach it.

0 Kudos
Message 3 of 12
(3,327 Views)

I know the wait function doesn't belong there in the enum. I can change that.  I want the local so the operator can see the change.

0 Kudos
Message 4 of 12
(3,317 Views)

@MPerlick wrote:

I know the wait function doesn't belong there in the enum. I can change that.  I want the local so the operator can see the change.


You really need to answer all questions.

 

It makes no sense to write the newval to a local variable of the control that just changed. The values will always be identical already. (Or do you have several controls with the same label?)

0 Kudos
Message 5 of 12
(3,314 Views)

I can't duplicate the problem with a separate vi. There should be nothing else running but this loop with the event structure. I'll make sure I'm using a local for the event structure. Thanks for your help. I'll check my code, but so far only the enum causes this problem.

0 Kudos
Message 6 of 12
(3,312 Views)

@MPerlick wrote:

I'll make sure I'm using a local for the event structure. 


That sentence makes no sense!

 

(...and I just said that the local is not needed)

0 Kudos
Message 7 of 12
(3,309 Views)
Solution
Accepted by topic author MPerlick

I finally was able to make it work by taking your advice. I use a local variable to change the enum "Code" in the event structure.  Now it no longer locks up.

0 Kudos
Message 8 of 12
(3,221 Views)

Something sounds suspicious and strange here.  I believe you treated the symptom, but not the cause.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 12
(3,215 Views)

I still don't understand why you think you need the local. Unless this is a different "Code" from the one that triggers the event structure then it already has the value. Is this "Code" an indicator? 

 

Also, how is this different from the code in your first post? I don't believe that you have fixed your underlying problem as I suspect that the problem lies elsewhere.

 

Do you intend for this loop to exit when Code changes?

 

Perhaps a more precise definition of what you're trying to do would help in the absence of posting code.

0 Kudos
Message 10 of 12
(3,199 Views)