LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Buttons

Solved!
Go to solution

Hello all,

 

I am looking for a way for when, I press a "Load" button. My vi takes in the parameters that I have set, such as a string, 2 double, etc. And dynamically creates a button on a grid with my given parameters. I know how to do the basics with LabVIEW such as passing parameters to another vi's, I am just asking about a way to create dynamic buttons on runtime. Thank you for your help.  

0 Kudos
Message 1 of 33
(5,503 Views)

What do you want to do with this button once you have it created?  How will its terminal be connected in your LabVIEW block diagram?

 

You can't create buttons dynamically.  They need to be created in a VI at edit time.

 

What you could do is have buttons created and hide them.   Then when you want to "create" one, you make it visible and change its position by writing to its property nodes.

0 Kudos
Message 2 of 33
(5,488 Views)

I want the button to be there with my string, and the correct min/max double on a grid, and If I click on it, a dialog asking if you want to delete it.

 

Okay, I will try doing that and get back to you. I understand you can not create buttons dynamically. So, how about a rectangular shape with my text in there on a grid from lets say, the x-axis being 0-10, and y-axis being 0-50.

 

If I went with the picture function vi's, how can I click on anywhere on the shape I created, and delete it.

 

And if I wanted to create again, I set in parameters, then press the "Load" button.

Sorry if I am being unclear, and thank you.

0 Kudos
Message 3 of 33
(5,475 Views)

"Been there. Done that!"

 

See here for a paper that discusses one of the times I wrote a LV program with configurable GUIs.

 

This is an excellent project if you want to fully appreciate the work that NI has put into LV. Using the picture control you are only limited by your ability to manipulate images and the amount of time you want to devote to it being truly flexable. Click detection is JUST a mater of comparing mouse click locations with where you put the virtual control.

 

But before you go there...

 

First think if you can put an upper limit on the number and type of controls. If you can do that, then you can go the easier way and have a bunch of off-screen control that are hidden until you want them. Then move then to where you want, size and set them... much easier than starting from scratch and recreating LabVIEW in LabVIEW.

 

Read the paper I link above.

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 33
(5,446 Views)

@flezt wrote:

...and dynamically creates a button on a grid with my given parameters. 


Can you show us a graphical sketch how it all should look like?

 

You can generate anything using a picture indicator and then "interact" with it by getting mouse down coordinates, for example. No matter what, in the end the entire front panel is just a 2D array of pixels, just that LabVIEW typically takes care of some of the UI processing. 😄

0 Kudos
Message 5 of 33
(5,436 Views)

No thread of this type is complete without Christian's art work.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 33
(5,425 Views)

Can you show us a graphical sketch how it all should look like?

 

Should be relatively easy to imagine this one. A grid with x and y axis where my dialog buttons will be "created in"(hide/unhide). And right next to that will be a couple of /parameters which should be the name, and horizontal x axis min/max. Maybe a numbering scheme for the Y axis, we'll see. But I can draw something up if you would really like. 🙂

0 Kudos
Message 7 of 33
(5,420 Views)

something like thissketch.jpg

0 Kudos
Message 8 of 33
(5,396 Views)
Solution
Accepted by topic author flezt

This should get you started.

 

Thread with picture control examples.

 

Thread with event for Picture control Nugget.

 

Have fun!

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 33
(5,374 Views)

I have a couple of things to add here.  First is my very beta like Multi Panel Interface which was a proof of concept for semi-dynamic control creation, and rearrangement. Here is a video demo.  It didn't get too far beyond that but the idea is you could register for data sources similar to VeriStand and add saving and loading panel config.

 

The other thing this reminded me of is the Toolbar Class I made a while ago.  With it buttons can be created or manipulated on the fly, with PNG images as the source of each button.  I could see this being useful on a user customizable UI where maybe all the functions of the software are available and a user can select what buttons and in what order should appear.  Then that UI is made using a picture control and mouse events are tracked with the user events made.  Still I don't think this is the same as what you are asking for but adding new buttons could be done.

0 Kudos
Message 10 of 33
(5,366 Views)