LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can i programmatically add control to a front panel in Labview

I want to add control to my front panel programmatically.

This will be part of a labview program to auto-generate labview code.
LabVIEW ChampionArchitect
0 Kudos
Message 1 of 10
(9,297 Views)
This is something that comes up here from time to time. At present there is no way to programmatically add controls or indicators to the front panel. The best that people have been able to come up with is to put a number of controls on the front panel and make them visible as needed. If you set/read them by reference then all you need is the name of the control.

Rob
0 Kudos
Message 2 of 10
(9,297 Views)
If you think about what you're asking for it would be very difficult. If a
certain condition were to happen that would induce a control to be
automatically generated where would the control be placed on the screen?
What type of control would it be? What would it look like? If you know
these answers before hand then it is worth creating the control as you
desire and simple enabling or disabling it as required based on you
condition.
-Tom

"Dany" wrote in message
news:50650000000800000012340000-1005954886000@exchange.ni.com...
> I want to add control to my front panel programmatically.
>
> This will be part of a labview program to auto-generate labview code.
0 Kudos
Message 3 of 10
(9,297 Views)
Dany,
You can surely have a list of controls which a user can selectively hide/unhide (visibility prop). You can even have controls for each control to position these controls around (position prop), and then you can let the user change their colors, size, and basically any property you want (all through property controls). This could all be set up (pre-coded) on your front panel. In fact, it would make for a neat application - where the user can select all these items from some sort of configuration screen.
The test is, however, adding the wires to the controls in just the right way to make this on-the-fly user panel perform some logic (there are no property controls for wires). But, with full use of references, etc., and a lot of pre-coding to handle all
the options for the user (case structures, etc.)- you could get close.
If you ever do, please post the result.
Good luck with it.
Doug
0 Kudos
Message 4 of 10
(9,297 Views)
You can't create LabVIEW controls/indicates at run-time. But you can create window controls/indicates , such as string, button, etc., at run-time. There are examples on my web page which show you how to do this (in LabVIEW5.1 only!!)

If you want to auto-generate LabVIEW code in edit mode, the only way is to simulate mouse click.

George Zou
http://gtoolbox.topcool.net
George Zou
0 Kudos
Message 5 of 10
(9,297 Views)
Hi Dany,

what your are asking for has been done with the new version of Vision
Builder (I think it is version 6).

This piece of software (it is an NI product) can programmatically build VIs
(adding controls/indicators, and the code to support them)

This probably isn't much use to you, but I thought I would mention it.

Good luck

Denis
0 Kudos
Message 6 of 10
(9,297 Views)
I had a similar case as you have, the difference being that i had to programmatically add indicators to a front panel. The way i did it was to create an array of indicators and control the size of the array. you can use the property (or attribute) node and select the number of columns as the property , then change that to "write" and add the array size at its input. That should add the controls to your front panel depending on your requirements and it would do it programmatically.

Hope that helps
Good Luck.
Message 7 of 10
(9,297 Views)
I am not sure if you found an answer to your problem. But here is an attachment you might find useful.
Message 8 of 10
(9,299 Views)
I'm having the same problem too. Currently I have a cluster of 9 elements (strings) and a 1D array. How can I change the string indicator inside the cluster depending on the value of the 1D array?
0 Kudos
Message 9 of 10
(9,074 Views)
I don't think your question is related to this post in any way. I would recommend starting a new thread with a more detailed description of your question and perhaps an example VI that illustrates what you are talking about.
 
Kind Regards,
E. Sulzer
Applications Engineer
National Instruments
0 Kudos
Message 10 of 10
(9,045 Views)