LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create controls using a loop

Here it is but it's not what you want.  This just makes an already existing array control visible and sets the number of elements.

 

What you want to do appears to be in the realm of modifying the language itself.  Scripting is the only real solution so you need to prepare to deal with some pretty advanced programming concepts. 


LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 11 of 17
(1,648 Views)

As mentioned before, you cannot dynamically create native controls on the front panel of a running VI.  Doing so changes the VIs code, causing it to need a recompile.  However, you can put a picture control on your front panel and do just about anything with it.  Picture controls have a fairly good set of user events, so you can create "controls" and "indicators" on the fly, subject only to your drawing and interrupt handling expertise.  Of course, this is not a trivial task.  It does, however, get around the dynamic control issue.

0 Kudos
Message 12 of 17
(1,639 Views)

If you are not familiar with LV then scripting (which amounts programming the steps you would do if wiring the VI yourself) is not a good option. There are other options but lets first see if the simple approaches will get you where you need to go.

 

Explore the examples tht you have been given so far and let us know why the dod not meet your needs.

 

There are otther approach (besides scripting) tha can be used but again, walk first then run.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 13 of 17
(1,637 Views)

@DFGray wrote:

As mentioned before, you cannot dynamically create native controls on the front panel of a running VI.  Doing so changes the VIs code, causing it to need a recompile.  However, you can put a picture control on your front panel and do just about anything with it.  Picture controls have a fairly good set of user events, so you can create "controls" and "indicators" on the fly, subject only to your drawing and interrupt handling expertise.  Of course, this is not a trivial task.  It does, however, get around the dynamic control issue.


...and anyone resorting to using the Picture control...

 

I suggest cheating as much as possible. A simplifying approach would detect the mouse click by the user and then make visable an "off-screen" control of the proper type, and move it to where they clicked and then set the key-focus to the LV control. When done put the control away and use it image in the picture.

 

The "chaeting part" is using LV to support the widget behaviour rather than trying to code it up using first principles. (been there done that, since the customer was a LV developer themsleves and they explicitly specified he wanted it done the hard way).

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 14 of 17
(1,634 Views)

Thank you all for help.

I'm not new to LabView, but scripting isn't my competence.

 

I will try out your suggestions.

 

Thanks everone!

 

 

---
LabView 2009.
0 Kudos
Message 15 of 17
(1,629 Views)

@Ben wrote:

 

...and anyone resorting to using the Picture control...

 

I suggest cheating as much as possible. A simplifying approach would detect the mouse click by the user and then make visable an "off-screen" control of the proper type, and move it to where they clicked and then set the key-focus to the LV control. When done put the control away and use it image in the picture.


I was intrigued by Ben's suggestion so I threw this together (in LabVIEW 8.2).  Set the Number of Controls, run it then click on any "control" to edit the value.  There's a fair bit of work to do to put this into production (try adding more controls than will fit on the picture), but it's not a horrible prospect.

 

EDIT - hit enter to set the value (I hate it that a value change isn't triggered when I click another control).

 

Dynamic Controls_FP.png

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

Message 16 of 17
(1,616 Views)

@jcarmody wrote:
...

I was intrigued by Ben's suggestion so I threw this together (in LabVIEW 8.2). ...


Full Discloser: JP Drolet was the person that inspired my to take that approach in the first place.

 

That is method I used to do this VI back in LV 6i (where there was bug where the background color was always black)

 

Single cell mode.

 

 

Multi-cell mode

 

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 17 of 17
(1,607 Views)