LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to lock certain elements in cluster array?

Solved!
Go to solution

Hello! Easy question for monday morning!

 

I want to create a cluster array and disable editing of certain items. Example:

 

Let's say I have a array of products. One type of product is one cluster. I want to have product name and unit price be locked (not editable), coming from some "database", and then have one element "number of products to buy" be editable.

So that I can edit only edit how much I want certain products but everything else fixed.

I tried to play with Property Nodes but could not find right ones.

 

 

0 Kudos
Message 1 of 5
(3,687 Views)
Solution
Accepted by Turzt

Hi Turzt,

 

you can change each control's "disabled" property!

 

Right click the "product name" control and open its properties dialog. Change "disabled" property to "disabled" (but not "grayed out"!). Do the same for "unit price". Finished…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(3,680 Views)

You can right-click the desired cluster element and chose "advanced...enabled state...disabled". There is also an equivalent property node. Right-click the "price" element and "create property node...disabled", create an diagram constant on it and select the desiresd state.

 

Note that this functionality only works in run mode. In edit mode, everything can be edited, of course.

Message 3 of 5
(3,677 Views)

Thanks for replies! I'd like to ask one additional question in the same thread as it is just an extension of my example application above.

Now I want to add one more level of hierarcy to product list: I have a combo box / enum etc. "drop down menu" in each row. First I select category like "vegetables", "breads", "candies".

This list items are fixed. But when I choose one, I'd like to have category specific subcombobox. e.g. If I select "vegetables", I'd like to have next field only have certain items "carrot", "orange", "apple" selectable and not "dark break", "wheat bread" etc. If I edit items in enum, the available items are then applied to every row (array item) which is not what I want. Can someone tell how to implement such?

I already found how to find out change event and compare old value and new value but I cannot change selectable options.

 

0 Kudos
Message 4 of 5
(3,647 Views)

Hi Turzt,

 

general rule: in an array all elements share the same properties, they only differ in value!

 

So setting properties for one element sets them for all elements…

 

My advice:

Don't use an array directly on your UI - this will avoid any problems like this. Use a multicolumn listbox tto present current values to the user. Let him select a row in the listbox and allow only editing for that specific row…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 5
(3,643 Views)