12-30-2010 12:10 PM - edited 12-30-2010 12:18 PM
I wanted to put a "help" button in my program in case the user needs to know what to do. My first try was to add an event structure, but that seemed to make the program hang up which I do not really want. The flat sequence is because I don't know how else to make it wait for the user to create a new spreadsheet file. I feel like there must be a nicer way to do this than with three while loops and local variables, but I don't quite know how... Thanks for any help, photo is attached.
Solved! Go to Solution.
12-30-2010 01:16 PM
For the help display, use an event structure. Add an event case for the Help button Value Change. When the user clicks the button, the event fires and whatever code is in the event case will execute. Put the event structure in a while loop and set the timeout (hourglass) to 100mS. That way the user can press the help button over and over, and if the user never presses the button, the timeout will make sure that the event structure executes at least once so that your code won't hang there. You will also need a stop button to stop the event loop.
As for local variables, it is best to use wires. Where is the code that produces the values?
12-30-2010 01:41 PM
After thinking about your code, I would suggest you use a state machine. I have included a simple state machine example that would suit your purpose (in LV2010). Modify as needed. Be sure to have the error wires just as they are. They control the execution flow.
12-30-2010 02:49 PM
You already got some good advice, so let's quickly look at your original code for problem areas:
12-30-2010 03:39 PM
Well, I've been working on it, but I want the "Help" button to be available even before you start, so I was trying to do it all inside an event structure. I am not sure how to open a reference to the spreadsheet exactly
12-30-2010 04:21 PM
Here is what I've worked out so far... with the data given by a random number generator in case you want to run it. The part I am still hung up by is that it seems like the "help" button still pauses everything. Also, I am not sure how to make the spreadsheet writing take up less resources. Thanks for the input!
12-30-2010 05:43 PM
Never mind, I believe I have just about done it! There is one extra file close/open than necessary, but not with every single write operation. Thanks for all the help!
12-30-2010 07:01 PM
You don't need to convert to a 2D array, just wire the 1D array to "array to spreadsheet string".
01-03-2011 10:06 AM
Alrighty, thank you much!
01-10-2011 10:28 AM
Just out of curiosity, how come they use a wire running to the case structure, although they don't use the value from it?