LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disabling entry into empty ARRAY element ?

Solved!
Go to solution

LV 2010.0

 

I have a UI problem.

I have a cluster of input stuff, arranged as a row.

On a front panel, I have an array of these rows, so the user can edit the test mode in progress and the modes upcoming.

The array has the INDEX control hidden.

 

I have room for 15 rows on the panel.

15 is enough for 90% of the cases, but for those others, I use the vertical scrollbar of the array.

 

The problem is, if I have 20 rows (0..19) in the array, the scrollbar will let me scroll down and show me element #20, which is empty.

It will allow me to enter something into row 20, and then it will allow me to scroll to #21, etc., etc.

 

I want to prevent that.  I have an APPEND button for creating a row the way I want it.  Entering zeroes into the row is not good (some fields are P-I-D constants).

Not to mention that the highlighting is done via a color box behind the number fields, when this would-be row appears, the default color is black, which is dimmed by the fact that it's non-existent to an ugly gray. Which matches the text color so it's one big gray stripe.

 

I already have code to detect a mouse click and highlight the row you click on.  So I can detect a click on the bogus row and discard the event, meaning you can't actually create a new element.  That's necessary for the safety of the machine and that all works fine.

 

But how can I stop it from appearing?

 

If there are 15 or fewer rows in the test, I set the NUMROWS to however many I have, and hide the scrollbar.  That's fine.  But I need the scrollbar for the bigger tests. But it insists on showing me N+1.

 

I could conceivably poll the INDEX VALUES property and if it gets to the point where the bogus row is showing, I change it back.  But that is an ugly hack, big-time.

 

I don't see any properties for adjusting the limits of the scrollbar. I don't see a property for DON'T ALLOW NEW ELEMENTS.

 

Is there something I can do?

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 18
(4,528 Views)

Hi Steve,

 

Put a transparent pciture over the empty element to prevent clciking on it.

 

Use Mouse down filter to decide if you should discard.

 

Before NI exposed the scroll bar on the arrays it used to be possilble to hack the array control replacing the index control with a slider and setting the limit for it. "tst" pointed that out in one of the old scroll-bar threads going back to about LV 7.

 

Just throwing out ideas while my coffee starts to work.

 

Ben

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

Steve,

 

An indirect approach: Make the array an indicator.  Use an extra copy of the cluster (a control) for entry.  When the APPEND button is pressed, check the length of the array and append or advise the user that the limit has been reached.  Or, better, if the length limit has been reached, disable and grey out the cluster control and the APPEND button so the user cannot put anything in.

 

Lynn

0 Kudos
Message 3 of 18
(4,520 Views)

Looks like my subject line is misleading.

 

I can already disable the entry itself.  I'm detecting the mouse click, and if it's on the bogus row, discarding it.

 

What I really need to know is how to stop the bogus row from appearing.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 18
(4,517 Views)

Well, Lynn, if I make the thing an indicator, then they can't enter into it.  It really is a control, I do need to enter values in the rows that EXIST.

 

I can stop them from entering the row that doesn't exist, but I can't seem to make it disappear.

 

Maybe I have to provide my own scrollbar/slider/something, and provide my own behavior.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 5 of 18
(4,515 Views)

Here's a picture of what I'm talking about.

 

I've changed the limit to 6, instead of 15, but the idea is the same.

 

I can stop you from clicking on that bogus row.  But I'd like it to not appear at all.

 

Screen shot 2011-05-23 at 9.17.47 AM.png

 

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 6 of 18
(4,508 Views)

I think that your issue has been discussed before, although I did not search for it.  I have never seen a clean solution.  Since you need a variable number of rows, you will probably need to do the custom thing.

 

Lynn

0 Kudos
Message 7 of 18
(4,507 Views)
Solution
Accepted by topic author CoastalMaineBird

I think I claimed to have posted an example in this thread. If not the final solution I think that will get you part way. Like I said, I have seen this done.

 

Ben

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

OK, thanks, Ben.

I'll check it out.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 9 of 18
(4,498 Views)

You can get a bit fancier for controlling the array by adding your own navigation and insert buttons. When you want to prevent someone from adding something you can simply disable the add (+). Even if the type something in you can remove it when they atempt to add it. Here is a basic example of what I am talking about.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 10 of 18
(4,489 Views)