LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Controls "on the fly"

Ok.. here goes nothing... We have a process in which we follow a router... Routers have anywhere between 10-100 steps... So I can do what I want very easily by knowing how many steps I have, I just create a control for each step thats made up of a cluster of three data points and I plug in different types of data on cluster representing the step that i am in...


Now lets say i want to scale that across many different products where there may be different amount of steps... I want to create those clusters and do my data mining to fill in the necessary data without creating 100 unique instruments... or having to update it each time the router changes...

So if you look at the attachments.. each one of those boxes is a control... representing a router step.. I want to recreate that in a way in which I don't know how many I need.  I'll know by grabbing some data off a sql server
0 Kudos
Message 11 of 22
(5,174 Views)

I'm not sure if you just want to automatically populate your FP with LV control and indicators that you will latter develop the code for

OR

Want an application that will populate the FP while it is running.

If you just want drop controls based on the SQL query that you will then wire up, then look at LAVA's Scripting thread. BE advised that NI will NOT support code involving scripting.

If your app has do this while running, then you can use the Picture Control as previously mentioned by Christian Altenbach. To help you out with this version, I have been collecting links to Picture Related threads in a thread that can be found here. Everything you will need to create controls on the fly can done using those links. You may want to skip to the recent link ( here ) were I posted some code that gets you most of the way there. (see image)

That example shows you how get your image, put it in a picture and latter determine which object the user clciked.You JUST have to adapt it for your use. I have used this technique for years and sometimes fool myself when I attempt to double-click one of my "Virtual Controls" only to find the terminal for the Picture control.

I should warn you, that this approach is not intended for the more timid amoung us.

Ben

PS Great picture Christian!

Message Edited by Ben on 12-19-2007 04:06 PM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 12 of 22
(5,153 Views)
I see two options, all involving some (about two week for sure) work:
  • Create 100 Clusters, wire them together in an array as references, and hide/show them as required, make some (only during development time active) code to arrange them as desired and so on.
  • Make some kind of picture-array. Use a subVi schowing the control you want to replicate, call these and get the FP-image to display in your picture-array. The in queue could be an extra array element.
For clarification, some more questions:
  • Is 100 a hard upper limit?
  • Is it all only visualisation (so no control involved here)?
Actually, I would suggest to evaluate the tree control. or a simple table, and if you need to evaluate bottle necks, a Bar-Plot comes handy... I propably have an idea what you want to do, but I think it's saving time to go a step back and think about, what information is needed by the user. So a simple Table with coloms like 'input queue', 'process name', 'progress', 'status', 'items in process' could do the same, additional information might be done by using colors (you can assign a color on each cell individually.
Just because we are graphically thinking, our users might be more used to boring excel spreadsheets or stoneage staus listings. And be happy, if we put some color on it.

Felix

PS: I myself will go on with that picture idea, could be a solution for a problem of  mine (same issue: unknown number of similar data sets).
Message 13 of 22
(5,142 Views)
How about a 2D array of pictures? Based on the figure posted the element would be a picture of a cluster, a picture of the arrows with the red box in the middle, or a spacer of some kind.
Message 14 of 22
(5,134 Views)

Roons,

After looking at your picture closer,  

I strongly urge you to look at the code and discusion in this thread where Jean-Pierre and I started brain-storming   "how to create dynamic controls" starting on 8-Feb-2002. His posted code was intended to be driven by a DB.

Please read that thread and look at his code.

Ben

PS It may need some updating but the ideas are still the same.

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 15 of 22
(5,121 Views)
I would suggest to investigate the picture control. I have used in an applcation where I had to draw tha track layout of a railway yard. The track and point or updated automatically based on the values of the variables. You can create VI's for different object and draw them when necessary. If you keep them in an array and only concatenate (picture are just strings) them on change to an object, you only have to redraw the object that changed.

I try and post a concatenation example later today.



Message Edited by andre.buurman@carya on 12-20-2007 09:57 AM

Message Edited by andre.buurman@carya on 12-20-2007 09:57 AM
Regards,
André (CLA, CLED)
Message 16 of 22
(5,087 Views)
What would be the problem with creating a class called "Router Step" that has shared information on each step, then subclasses on each different type of step?  You could have a dynamic dispatch VI that would be something like "Process Step", etc.
 
LVOOP is your friend.
(I only found this thread from the link to the fly, so thank Altenbach if you like my idea)
 
Edit: then you can just have an array of classes, all with their special class-like superpowers  (We have a class based test executive here and it works great)


Message Edited by Britoa on 12-20-2007 06:45 AM
Message 17 of 22
(5,058 Views)
I wish I wasn't a novice... I never really ahd to do much besides write VISA commands and queued state machines.  Guess its time to try and get my feet wet a little more, because I don't understand half the stuff you guys are talking about.  HAHA.. Thanks I will be doing a lot of reading today.
0 Kudos
Message 18 of 22
(5,044 Views)

Hi Christian,

I'd like to use your picture for a paper I have to write. Of course I will cite you as the artist.

So would you mind granting me permision to use it?

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 19 of 22
(4,559 Views)

Ben wrote: So would you mind granting me permision to use it?
Of course! I have no problems with that. 😄
 
(The fly itself is from a google search and the LED and switch are probably © NI. I would think this falls under fair use. (e.g. parody), but I am not a lawyer and I don't even play one on TV. 😉 . So far I have not received any strongly worded letter from the NI legal department. :D)
Message 20 of 22
(4,542 Views)