LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programicaly resize buttons

We're trying to create a user interface where a grid of buttons will represent a plate of circuits to test. There plates range in size from 4x4 to 18x18. We have created a 18x18 grid of buttons but would like to programicaly hide/show the requried number of buttons and to resize them to fit into a decoration to represent to plate under test.
Is there a way to access the properties of all 324 buttons by name instead of creating 324 property nodes, or is there a way to create the buttons on demand?
0 Kudos
Message 1 of 9
(3,701 Views)
One way is to use a 2D array of booleans and then use the VI Server properties to programmatically adjust the number of rows/columns displayed as well as the size of the button. See attached example.

Message Edited by smercurio_fc on 09-07-2007 09:45 AM

0 Kudos
Message 2 of 9
(3,688 Views)

I am sure there is no way to create buttons on demand because I believe the button has to exist at the time the code is compiled before execution.

You could build an array of references to each of the controls.  That way you can iterate through the array, send the reference to property nodes, and set the size, location, and visibility accordingly.  However creating the 324 references the first time could be quite tedious.

I'm sure one of the more expert forum members has or knows how to use the more detailed class properties of the booleans to build the array of references more programmatically.

I see Smercurio has gotten an answer in quicker.  I guess one question would makes a difference in coding is whether the boolean buttons would be a 2-D array (such as Smercurio posted.)  Or whether you need to have the buttons be individual entities, in which case you need and array of references to each button (more in line of what I was thinking).  If the user interface allows it, Smercurio's method using a button array would be much easier to work with programmatically.  The question is how is the rest of your program using the values of the buttons.

Message Edited by Ravens Fan on 09-07-2007 11:02 AM

0 Kudos
Message 3 of 9
(3,684 Views)
No claims to be an expert.

You can get a reference to the panel and then use the Controls[] Property to get an array of references to all the controls on the panel. You may need to use the Label text to identify the particular control you need. If you have complex controls such as clusters, getting a reference to a subcontrol can be messy.

Lynn
0 Kudos
Message 4 of 9
(3,674 Views)
2-d array of booleans is good idea.
 
Use the array property "arra element" and cast it as a boolean refernce then set the size of the boolean.
 
In the Picture Control thread  reply #4 points at a "Random Walk" example were I create a user specified number of booleans, set their colors and properties befoe playing a game of "Hang Man" to speel out the phrase "Hello World".
 
That example was written to be obfuse BUT it does contain all of the examples you need to give the impression you are creating "virtual controls". Everything except the clicks.
 
Please post an example of how you solved this problem in the end.
 
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 5 of 9
(3,669 Views)
Create a property node, and right click it. Select Link to... and select "pane". (LV8.0>)


Or... Get a reference to the front panel. Create a property "All Controls" (also lists all indicators).


In a for loop, get the Label.text property, and if the name matches, so your thing.


Regards,


Wiebe.
0 Kudos
Message 6 of 9
(3,668 Views)
What I forgot to mention was that we would also like to have access to each buttons properties to change color while under test, text, and disabled.
0 Kudos
Message 7 of 9
(3,660 Views)
You can do those things with property nodes.

You will not be able to use the array as suggested by Ben, because all the elements of an array have the same properties. Properties of individual elements cannot be set separately.

Lynn
0 Kudos
Message 8 of 9
(3,658 Views)

Yes, Lynn is correct that you can not set the properties of individual items inside the 2-d array.

In reply #52 of this thread the example labeled "Obfuse Picture" creates 135 booleans with individual colors and labels.

Ben

Message Edited by Ben on 09-07-2007 11:34 AM

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 9
(3,645 Views)