LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmatic add a control to a vi at runtime

Hello,

There is a posibility to add a control to the front panel at the runtime, programmatically?

0 Kudos
Message 1 of 13
(4,686 Views)

No.  But what exactly are you trying to do?  There is likely other things that can be done.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 13
(4,684 Views)

I have made an application for data collection and viewing them.


Now I realize a tool with which a user can create his own view of the data collected.
For example:

Over a drawing that represents a functional diagram of the installation, are placed some indicators that can display text or a picture. The "string" indicator displays the status or a value of a sub-assembly, and the "picture" indicator displays a graphic image that suggests the condition. There may be several such views for an installation. Each view can have a different number of indicators positioned differently.
The tool must place the indicators on the installation drawing and then their positions to be saved in a file.
Because the number of indicators is variable, wondering if it is possible that when the VI, that displays a certain view of the user, is loading, to define a number of indicators corresponding to the desired view.
Current solution is a VI that has 32 pairs of indicators, the user sees only those defined for the selected view. The solution has a limit to only 32 indicators. If the user wants to view more than 32 indicators, I should upgrade the current VI.
The VI that displays a user's view is loaded dynamically with "call and forget" and "reentrant".

0 Kudos
Message 3 of 13
(4,623 Views)

it is really not clear for me what you need, it is difficult to visualize what kind of indicators you want to show. Could you post the VI which you call dynamically?

0 Kudos
Message 4 of 13
(4,594 Views)

Attached is a capture of the front panel of the VI that build user-specific views.
I have also attached the file "wallpaper" to better understand who and where are indicators.
Information is shown using three indicators:
1 - "picture indicator" that displays a picture suggesting the value or range of values of information.
2 - "picture indicator" that displays a glyph of state information.
3 - "string indicator" that displays the value of information
4 - "caption of string indicator" that displays the name information (point 4 is a component of the "string indicator", point no.3)
A piece of information is presented using three indicators. Depending on the designer's desire either of the indicator can be hidden. For example: "date # 1" is presented using only two "picture indicator".
In this case are used in total 24 sets of indicators, in which some elements remain hidden. The remaining sets, up to 32, remain completely hidden.
In other cases, the designer can imagine situations in which needs more than 32 sets. For these situations should create a VI with several sets of indicators from which the designer needs to use each. The question that arises is: what is the maximum number of sets? To bypass this question, I asked if it is possible to add sets of indicators in proramatic way. The answer came quickly: NO.
I do not have another idea.

Download All
0 Kudos
Message 5 of 13
(4,569 Views)

Interesting challenge - I'm thinking as I type here, so sit down for a minute or two an follow my thoughts...

 

  1. The only way to CREATE new FrontPanel elements programmatically is VI scripting, which is not truly available in the runtime engine (i.e., a built application).
  2. As far as I understood it, VI scripting CAN be included in the runtime engine but there are restrictions on doing so which are laid out in the terms of use (or the license agreement) of LabVIEW applications. You're not allowed to give the user the ability to "program LabVIEW" by using your application, which would circumvent the necessity of purchasing LabVIEW licenses. AristosQueue made a comment about this in this thread: https://lavag.org/topic/8488-dinamicly-create-vi-in-a-builded-application/
  3. Seemingly the best way to deal with an ARBITRARY number of user elements is an array. However - displaying an array usually gives you no possibility to move elements around independently. Thus this option is out, as far as I know about arrays. But maybe someone has a clever idea here.
  4. The next idea would be to move towards images (Vision Development Module) or pictures which would resemble the interface for the user. Within a picture you can draw, add and remove whatever you like. Think of the interface the user is building as a PowerPoint Slide. You add lines, images, shapes and so on and you can move them around and type text within them. Perhaps this work-around is worth thinking about. Of course - the effort you'd have to put into mouse cursor movement and button capturing and so on would be tremendous. But it's the only thing I personally can think of.
  5. How's this: Use a hidden array to deal with the unknown number of elements. The array element is a cluster (typedef) containing all the information needed to create the appropriate system interface picture (which glyph, included text(s) and color(s), position, connected values to determine the color/text etc.).
  6. Beware: The number of different collected data items that the user can build into a visualization should be limited by the system that exists (e.g. number of sensors). If not, you provide the user with a possibilty to add functionality the application user didn't have before. See Point 2. But then again: If the number of different data sets is limited (because of limited data sources aka sensors) - why don't you know in advance how many Front Panel elements you would need at maximum?

Does that help?

 

0 Kudos
Message 6 of 13
(4,550 Views)

Scripting can be an elegant solution, but I have to see how solve the license and the inclusion in the run-time engine.
In the main application, I do not think it is a problem because the user can not change anything.
The tool that creates custom view will have only function for generating indicators, without the possibility to edit connection diagram.
Another option is to use for the tool, some pictures of the indicators, which move them, but I think it's a lot of work ...
To activate the scripting in run-time engine, who should I contact?
In any case, thanks for the information.

0 Kudos
Message 7 of 13
(4,515 Views)

This is actually the thread I wanted to point out to you:

https://decibel.ni.com/content/thread/4761

Starting with Answer 7 by Steve Karcher it becomes interesting concerning VI scripting in RTE. My guess (I'm not a NI employee or anything close to that) would be to contact your local NI sales representative, as is suggested by AristosQueue (who is with NI) in answer 12 of said discussion.

 

Other than that I agree that the "image" solution would be quite cumbersome though not unfeasible.

Message 8 of 13
(4,502 Views)

Thank You.
I read the thread and now began to be more clearly what the situation is.
First step: I'll use my SSP and will contact the NI representative.
I do not know whether to close this thread or to wait until I have a response from the my NI representative?

0 Kudos
Message 9 of 13
(4,487 Views)

Well, there's no way to really "close out" a thread, but it would be great if you could update the thread when you find the solution (and mark your post as the solution) so others may benefit from your knowledge.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 13
(4,464 Views)