09-28-2012 02:55 PM
Ah, that makes sense. I guess my original question should have been, how to use event structures. Put a timeout on it and it's working. Thanks for all the help and advice, I will try and implement all of the suggestions and if I end up doing more with LabVIEW I will get some actual training instead of bugging you guys on here.
It's probably a good thing I didn't know about sequence structures or I'm sure I would have abused them as well.
Out of curiousity, what are the problems involved with using the strings property nodes. I'm using them to eliminate previous selections from the available options to help eliminate user error.
I saw the race condition here after altenbach informed me of the problem in my other VI. I was planning on fixing it once I figured out how, but thank you for confirming it.
Thanks for the help,
dnorman
09-28-2012 03:47 PM
There isn't a problem specifically with using the Strings propery node; the problem, as with local variables, is that you're using them in a way that (at a first glance, anyway) looks open to race conditions because you read and write them in a way that doesn't enforce the order in which they execute.
Fundamentally, I think a combobox is the wrong control for this application. I notice that you do have the "Allow Undefined Strings" option checked, and if you are allowing the user to enter a value that isn't in the list then it's the appropriate control, but it looks like that's not the case. Use a ring or an enumeration instead. If you don't need to update the strings in your code, use an enumeration configured as a strict type definition (please look this up in the help if you don't understand it). If you do need to change the list programmatically, use a ring. Both of these types have a "Disabled Items" property which allows you to disable values while still leaving them in the list, and that probably makes sense in your user interface. It avoids the race conditions and cleans up the code, because you can use the numeric value directly instead of searching through an array of strings.