LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating new objects on the Front Panel at runtime.

Solved!
Go to solution

Hello, 

I am working on a drag and drop UI for defining a test sequence. I have some tiles (clusters) for each test that I create when the VI launches. The idea is that the user grabs a tile and drags it onto the timeline to define the test (this works fine, see image). My issue is that I define a finite number of clusters for each test and then stack them on top of each other. I would rather create a new instance of the cluster on the front panel each time the user grabs a tile and moves it to the timeline. 

 

My question; Is there a way to programmatically create a cluster object from a template (or typedef) on the front panel at runtime?   

 

Jay14159265_0-1690923542149.png

 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 1 of 22
(971 Views)
You could have an array that changes size. Just out of curiosity, is this an executable or source code?
Message 2 of 22
(959 Views)

@Gregory wrote:
You could have an array that changes size. Just out of curiosity, is this an executable or source code?

Having an array is an interesting idea. Visually I don't want to have an array but I understand how I could make that work. I have done some UI work where I rolled every UI element from picture and draw object privatives but that is so much work. I'm trying not to go there for this one. This is source code. 

Jay14159265_0-1690929015111.png

 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 3 of 22
(926 Views)

I'm imagining in my head that there may be some way to create a cluster from a typedef similar to how you would launch and load a .vit front panel by reference into sub panel at runtime.

 

If I have a reference to the typedef can I instantiate it an add it to the FP objects somehow? 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 4 of 22
(902 Views)

With scripting, one VI can edit another VI, as long as the VI being edited is neither running, nor reserved for run.

Message 5 of 22
(892 Views)

It is not possible to create FP objects during runtime, instead, you need to have them pre-created in the FP outside visual area and reposition them to visual area based on user selection to insert/delete/move objects.

 

Alternate idea - if these are just to represent, treat them as images, observe drag drop and update the image indicator to represent the appropriate block.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 6 of 22
(875 Views)

@paul_a_cardinale wrote:

With scripting, one VI can edit another VI, as long as the VI being edited is neither running, nor reserved for run.


That is exactly what I want to do. Too bad the vi has to be not running. 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 7 of 22
(866 Views)

@santo_13 wrote:

It is not possible to create FP objects during runtime,


Bummer, I was hoping there was some way. 

 

 instead, you need to have them pre-created in the FP outside visual area and reposition them to visual area based on user selection to insert/delete/move object

 That is what I'm doing now but the tiles are all stacked on top of each other and the user grabs the top one to drag into the timeline.

 

Alternate idea - if these are just to represent, treat them as images, observe drag drop and update the image indicator to represent the appropriate block.

 

That is an interesting idea. At the moment the tiles are fully editable on the timeline, and they attach to the cursor so they move with the mouse pointer when dragging. But there is not nearly enough room for all the data fields on each tile,  maybe only one or two fields and an image. At some point more data is needed to be entered so maybe each tile on mouse click could open an edit window for the fields and the tile itself would just be an image. But I need to display some user defined info on the tiles... I feel like I am going to end up rolling all the images from draw primitives again, which is what I am trying to avoid. I need to think about it. 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 8 of 22
(859 Views)

Based on your last piece of info, looks like the application will blow up large pretty soon. As you already figured out, a separate window to configure each tile or a subpanel to edit/view configuration of a tile will make it more scalable and keep your UI simple.

 

We created an application where there is a graphical programming/sequencing (like LabVIEW but limited), in the UI user can drag and drop various predefined blocks, configure, connect block together to sequence and create data flow. Save, retrieve and run the created pseudo-VI. All of these in an EXE build using LabVIEW and the end-user doesn't need to worry about LV licensing. This is made scalable using plugins for each block that show up in the palette of the application.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 9 of 22
(848 Views)
Solution
Accepted by Jay14159265

There is an invoke node for generating a picture of a control which you could use for this.

 

I am envisaging that you click on a tile, opens a separate config window which returns a new image 

 

Niatross_0-1690958340096.png

 

If I am honest, every time I do something like this I always resort to a table/tree with text describing the steps, it becomes much more manageable. You can even add icons to a tree control.

Message 10 of 22
(829 Views)