05-23-2011 07:33 AM
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?
Blog for (mostly LabVIEW) programmers: Tips And Tricks
Solved! Go to Solution.
05-23-2011 08:02 AM
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
05-23-2011 08:03 AM
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
05-23-2011 08:06 AM
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.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
05-23-2011 08:11 AM
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.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
05-23-2011 08:22 AM
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.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
05-23-2011 08:23 AM
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
05-23-2011 08:29 AM
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
05-23-2011 08:35 AM
OK, thanks, Ben.
I'll check it out.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
05-23-2011 09:28 AM
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.