06-18-2015 09:14 PM
Hi,
Is the attached VI normal operation? Why would changing a random control's property affect the behavior of an event structure?
Thx
Solved! Go to Solution.
06-18-2015 09:23 PM - edited 06-18-2015 09:46 PM
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.)
06-18-2015 09:27 PM
06-18-2015 09:34 PM
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.
06-18-2015 10:05 PM
06-18-2015 10:19 PM - edited 06-18-2015 10:23 PM
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.
06-19-2015 03:10 AM
@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. 🙂
06-19-2015 05:11 AM
06-19-2015 05:52 AM - edited 06-19-2015 05:54 AM
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.)