From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Controls "on the fly"

Let's say I pull a set of data points from a database.  I want to take those data points and make them controls based on how many data points I pull, then do whatever I want with them, like create refrences and what not.  I might do another data pull and it may have a different number of data points, but still want to do the same thing over and over regardless of how many data points there are. 

So I pull 16 data points into an array - I want to make those controls.. Then do my normal routine..

Same application is run for a different criteria, and you may get 10 data points, but then create 10 controls then do whatever I want after I create them.


Hope I explained it right.. Or is there something else I could that's better?
0 Kudos
Message 1 of 22
(7,381 Views)
Well, you sort of answered yourself by saying array. Just use an array. No need to "dynamically" create controls.
Message 2 of 22
(7,381 Views)
How do I create refrences on controls if I don't know how many controls I need to do the task.  Wow this is hard to explain.

I basically want X number of clusters and X number of boolean controls depending on how many data points I have.  Is there anyway to do that?  One time I may only need 8 clusters another time I may need 20 clusters....


Message Edited by Roons1159 on 12-19-2007 02:43 PM
0 Kudos
Message 3 of 22
(7,374 Views)
Arrays. It makes no sense to do it another way.

You can have two separate arrays, one an array of clusters, and another an array of booleans. The number of elements corresponds to the number of returned values.

Why do you need to create a reference to each element in the array?
Message 4 of 22
(7,362 Views)
Sorry, first I thought you are looking for something like this. 😄
 
 


Message Edited by altenbach on 12-19-2007 12:55 PM
Message 5 of 22
(7,360 Views)
You can't (well, not with any supported features) dynamically create controls. You need to explain what you are doing and what these datapoints are supposed to represent. There is probably a workaround but details are needed.
Message 6 of 22
(7,359 Views)
There is no such thing like creating FP objects during run-time (maybe next version? we really lack of that!).
You need to put that in an array. If I understand you right, you want a sub Vi that iterates over an array of references. Yes, you just need to bundle your references in an array.

If I missed your issue, maybe just specify an example use-case.

If it is FP-issues, consider using tables or trees.

Felix
0 Kudos
Message 7 of 22
(7,353 Views)
With a little bit (maybe actually a lot) of effort, you can just use one big picture control and make it look any way you want and any time. Then just parse the mouse operations in the various graph areas to do your desired UI functionality.
Message 8 of 22
(7,345 Views)
Or you "pre"- create the expected controls, make them invisible by default, and in runtime visualize and arrange them as needed. This would save the Mouse tracking.
Greets, Dave
Greets, Dave
Message 9 of 22
(7,340 Views)
altenbach, are you surreptitiously trying to convince someone to create a Rube Goldberg creation just so you can make fun of them? Smiley Wink
Message 10 of 22
(7,336 Views)