From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event structure behavior when a control's property is changed

Solved!
Go to solution

Hi,

 

Is the attached VI normal operation? Why would changing a random control's property affect the behavior of an event structure?

 

Thx

 

Untitled.png

0 Kudos
Message 1 of 9
(3,613 Views)
Solution
Accepted by topic author abeaver

DON'T  DON'T  DON'T ever use an event structure inside an event structure.

 

Read Caveats and Recommendations when Using Events in LabVIEW

 

What saved you from locking up the VI hard was that you unchecked the Lock Front Panel setting on your event cases from their default of being checked.

 

The reason it reacts that way is that the Pane: Mouse Up event is occurring when you go and click on the toggle.  So as soon as you Mouse Down on the string, that inner event structure already as the pane: mouse up event queued up and runs right away.

 

(Actually, that while loop is pointless because the while loop can only run once.)

 

0 Kudos
Message 2 of 9
(3,605 Views)
What was it that you were trying to accomplish with the nested event structures?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 3 of 9
(3,599 Views)

Asking about intended behaviors of nested event structures is a lot like asking what the intended behavior of headlights is while beating them with a baseball bat.  Doing so isn't intended.

0 Kudos
Message 4 of 9
(3,592 Views)
True, but the OP was trying to accomplish something and mistakenly thought this was the way to get there. Many times I gave seen really complex, convoluted code that was trying to do something that was basically pretty simple. I'm just curious about what the original goal was.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 5 of 9
(3,575 Views)

What I am trying to accomplish is maintaining my poorly written code from a few years ago without re-writing it. Basically I have an event that adds/deletes/resets user defined commands to a list and I wanted to implement a drag and drop feature (event structure required) inside that same event because all the required references are there. But it looks like I just need to create those references...

 

I understand what is happening now. Thanks guys.

0 Kudos
Message 6 of 9
(3,562 Views)

@abeaver wrote:

What I am trying to accomplish is maintaining my poorly written code from a few years ago without re-writing it. Basically I have an event that adds/deletes/resets user defined commands to a list and I wanted to implement a drag and drop feature (event structure required) inside that same event because all the required references are there. But it looks like I just need to create those references...

 

I understand what is happening now. Thanks guys.


IMHO if you know it is poorly written, it would probably be worth the effort to rewrite it.  From what I can see, you have an incomplete understanding of the event structure.

 

An extremely helpful link is here.  Scroll to the bottom for a bunch of really nice tutorials.  🙂

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 7 of 9
(3,532 Views)
I understand your desire to not rewrite everything, but maintaining bad code can easily take more time than rewiring it. To make fixing stuff like this easier, make it an iterative process. Start with the worst part and gradually work you way into the details. Also take advantage of what you have learned about the specific application you are creating to refactor how tasks are grouped into subVIs -- and be sure you are using subVIs.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 9
(3,519 Views)

Here's a quick draft how you could "fix" it. Should not take much in your more complicated case.

(Of course you might need to handle additional scenarios, e.g. what should happen in the mouse leaves the panel while the button is pressed? etc.)

0 Kudos
Message 9 of 9
(3,505 Views)