07-25-2009 12:10 AM
Hello all,
Iam trying to develope a Front end Gui. Reading data from a spread sheet, which has the following data 6 cloumn's 1) Parameter 2) Group 3) Max value 4) Min value 5) Default value 6) Value. Group is pretty much again classified in to 4-types.
a) Temperature group --- Slide
b) Switch --- Push button
c) Sensor group (voltage or pressure) ---- Knobs
d) Digital Inputs --- Numeric Input
From the spread sheet,for each parameter based on what type of group I should to create either a slider, or a switch or a knob or a Digital Input. And Based on 3rd and 4th column information, scale should be adjusted. 5th column should be used to set a default value and 6th column to assign a value
to that parameter.
07-25-2009 12:22 AM
Are you trying to programmatically create different controls and programmatically create your program? You aren't going to be able to do that.
If you have your controls already placed in your VI, you can programmatically read the spreadsheet and be able to change the properties of the controls such as the data entry range.
There is the possibility of using scripting, but that is such an advanced topic, there is no way I could recommend it to a new LabVIEW user.
07-25-2009 12:36 AM
Hey,
Thank u for the reply.Not excatly like programatically, but the no of parameters will be limited to the range of 15 to 20. So is there any way to predefine the controls in the Vi. and set the properties.
-Lucky
07-25-2009 03:01 AM
07-25-2009 10:38 AM - edited 07-25-2009 10:40 AM
You could set up 15 to 20 controls of each type on your front panel. You will need to work with references to each control to get and set properties since there will be no way to wire them up to any specific functions on your block diagram since which controls mean what will vary during run time. So you would move the block diagram terminals for the 15-20 controls of each type off to the side of your diagram.
When you go through your setup spreadsheet, you can set the visibility and front panel coordinates of each control you want to use. For any you don't want to use, you will make them invisible. Use property nodes to set the properties of each control.
When you want to read from or write to a control, you will need use the reference of the particular control with a property node to get or set its value.
This is not an easy archtitecture. You will need to maintain arrays of references for each type of control. You will also need to maintain a cross reference array so that you if want to access Control C (for example), you know which reference to index out which might happen to be element 1 in the array of slide references. Perhaps control G would be element 4 of your array of knob references.
But with good organization of your control references and perhaps some good subVI's for setting and obtaining the references so you can index them out of the appropriate array, it can be done. I would recommend looking at Ben's Action Engine Nugget for ideas of how to store the references in a functional global variable.
07-27-2009 11:23 AM
Hello Sir,
I seperated the data from my spread sheet in to 4 groups.I defined the controls in the front panel.And tried to create a property node for each control. But I dont know how to allocate each control to each parameter with their respective properties defined in the spread sheet. And also to make the excess no of controls as invisible. Can you take a look
at my VI once and help me out at this point.
-Lucky
07-27-2009 12:33 PM - edited 07-27-2009 12:34 PM
Here is a programmatically cleaner version of what you posted. Unfortunately, I don't have time right now to work on this. It would take an hour or so to get a working example.
I did had a part where I built an array of slide references. So once you figure out you want to set the properties or value of something like slide 2, you can index it out of the array and wire it to a property node to set its values.
07-27-2009 08:09 PM
07-27-2009 10:31 PM - edited 07-27-2009 10:32 PM
You can't change the name of the control at runtime. But you can change its caption.
Hide the label on all of your controls and make the captions visible. Now when you assign all the other properties, assign the name to the caption.text property.
07-27-2009 11:03 PM
Sir,
Thank you for your reply.. Adjusting the names during run time has worked can you pls find some time and look at the vi and help me to set the visibility and default values..
-Lucky