LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Suggestions for a good grid conrol option (table vs array vs cluster)?

Solved!
Go to solution

Hello,

 

I could use some friendly advice.

 

I am looking to make a grid like control for my application. I am looking to make a 50 x 50 grid control with elements that I can change the text, color and preferably be able to user select or deselect individually as well.

 

A 2D array works for part of it, but I cannot of course change the properties of the array element.

I am not sure if a cluster will work or not. I don't think an array of clusters will work.

I am leaning towards using a simple table. At least then I should be able to change the text and color of each cell, but I am not sure if I can select them or not.

 

I am just wondering if there are any suggestions that would be better. I definitely do not want to make 2,500 hard coded controls in my application. And I believe using dynamically created controls is frowned upon.

0 Kudos
Message 1 of 8
(270 Views)

One of the drawbacks to an array is that you can't set properties of the array, which you already mentioned.

 

If you make an array of clusters, it's possible to construct one of the elements of each cluster to be a "color box", and then back that the "back" element, and then for anything that's on top of it (a string control most likely) change every color except the text to be the "Transparent" color, and you now have it so that part of the array data determines the background color.

 

For selecting and de-selecting, you could add a check box control, have that be enabled, and disable both the string control and color box control so they're not enabled.

 

However, a table might work as well if you manually handle the "selection".  If you create an invoke node for a table, there is a method named "Point to row column" that converts coordinates you could get from an Event node detecting mouse down or mouse up on the table into it telling you which row and column the click was on.

Message 2 of 8
(258 Views)
Solution
Accepted by topic author DBISI

Sometime a picture control is the best and most flexible solution. You have full control over every pixels and the picture function offer a rich selection of primitives (circles, lines boxes, text, etc.) to simplify the task.

 

here is a recent example.

 

altenbach_0-1747321804094.png

Message 3 of 8
(235 Views)

@DBISI wrote:

I am looking to make a grid like control for my application. I am looking to make a 50 x 50 grid control with elements that I can change the text, color and preferably be able to user select or deselect individually as well..


Just for clarification can you resolve some possible misunderstanding.

 

You talk about a "control" (i.e. not "indicator"!) and it is not obvious how the user is supposed to interact with it. For example, do you want to user be able to directly change text and color, or is it sufficient that these are handled by the code. My above example allows select/deselect, and maybe that's all you need.

0 Kudos
Message 4 of 8
(217 Views)

@altenbach wrote:

@DBISI wrote:

I am looking to make a grid like control for my application. I am looking to make a 50 x 50 grid control with elements that I can change the text, color and preferably be able to user select or deselect individually as well..


Just for clarification can you resolve some possible misunderstanding.

 

You talk about a "control" (i.e. not "indicator"!) and it is not obvious how the user is supposed to interact with it. For example, do you want to user be able to directly change text and color, or is it sufficient that these are handled by the code. My above example allows select/deselect, and maybe that's all you need.


I have not set it in stone yet, but basically I need a control that I can select or deselect multiple items at once. Possibly be able to double click one and open an event. But I also want separate indication vs selection.

 

The picture example above looks interesting. I might try something like that. Basically, if I took that and had a highlighter were two of those green ones were selected, for example.

 

For colors there would be 3, on, off and select. Other than changing the text, nothing else would need to be done to the control itself.

0 Kudos
Message 5 of 8
(213 Views)

I use a table control and use the invoke node @Kyle97330 suggested. Once I know the cell the user clicked, I use a text ring that "appears" at the same cell at the same size that the user clicked. The text ring can be populated programmatically depending on cell chosen. The test ring disappears after the user selects a value or leaves the control. See below. This allows some flexibility with a static 2d string table control.

 

mcduff_0-1750271678231.png

 

 

 

Message 6 of 8
(187 Views)

It really depends on what you want to do. Here is a cluster array to do the same thing:

aeastet_0-1750274259644.png

 

The cluster will also give you flexibility to do more what your control. You can add check boxes, pictures, lights etc...

 

Tim
GHSP
Message 7 of 8
(169 Views)

I was able to get what I needed working. With a little tinkering.

Thank you for the suggestions.

0 Kudos
Message 8 of 8
(96 Views)