LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

help with user input

Solved!
Go to solution

hello,

 

      I'm working on a recipe application. In the attached code, using the up and down arrow one can browse through the recipe list and the corresponding recipe variables are shown in the indicators. I have two buttons , one for load recipe and other one for new/edit recipe. I have a question on the new/edit recipe section. Once I select the recipe using my up and down arrow keys and click new/edit recipe, I'm trying if I can pre-load the input variables with the values it already has before one can change it. Please do let me know your inputs.

 

 

thanks.

Download All
0 Kudos
Message 1 of 4
(2,784 Views)

The first thing I did was hit Clean Up Diagram to see what you were doing.  Your Block Diagram is VERY large.

For a quick solution to your question, I'd change the Prompt User Express VI into a regular sub-VI with an array input of recipe parameters and pass the appropriate 1D array from the 2D array you read from your file.  You can pass this data in a shift register whenever the selection changes, or you could simply index it when you need it for the Edit function.

You could also improve your entire program by putting more of your code inside the Event Structure.  Better yet, use one of the standard design patterns that are part of LabVIEW ("Producer-Consumer Design Pattern (Events)" or "Top Level Application Using Events").  You'll be better off with a standard/scalable/extendable architecture if you intend to make this program much larger.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 2 of 4
(2,757 Views)
And move the file read to outside the while loop or in an event. Don't see the point in reading the same file with every iteration.
0 Kudos
Message 3 of 4
(2,753 Views)
Solution
Accepted by topic author gsajja
I deleted the same sentiment from my post because he's writing the file after editing the recipe and I figured he will need to have that data available to read/edit. 

gsajja, this will go away if you change your program to pass all of the recipe data throughout the loop in a Shift Register.  You can read the file when the program initializes and write it (if something has changed) when the program closes.  This is what I was leaning toward in my first response, but more inclusive in that you can bundle all of your data into a cluster and pass that around your program.  The recipe data would be one element of that cluster, but you could have more.
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 4 of 4
(2,748 Views)