03-13-2014 11:08 AM
I've got a VI that allows users to set the date range in a control, and it's not working as it should. Specifically, the control is the standard Numeric Control from the Modern palette, it's data type is Double, and it is formatted as %<%D:%H:%M>t . The issue is that when I have the cursor over the Hours (both digits highlighted), when I use the keyboard up and down arrow keys or the inc/dec buttons on the control, instead of the Hours incrementing or decrementing, the Minutes do. When I have the cursor over the Days, the inc/dec acts on the Hours. There's no way to inc/dec the days in the control either. Also, if the cursor is the line cursor rather than a selection, the values that are changed are the values to the RIGHT of the line cursor - again the opposite of how LabVIEW behaves with other numeric formats.
Also, the left-right arrow keys won't move the selection / cursor within the control, except for moving from Hours to Days - no other movement is possible.
Is this a known issue? I'm seeing it in LV 2010 SP1 and LV 2012.
I've attached a VI consisting solely of the misbehaving control.
Additionally, I've tried the Numeric Controls from the System, Classic and Express palettes and they do the same (or worse).
I'm assuming at this point I'll need to use separate controls for each field, event handlers for the arrow keys, etc., but the complexity that adds is almost painful. If someone has another idea, I'm all ears.
Thanks,
Erik
Solved! Go to Solution.
03-13-2014 11:29 AM
It's because the underlying data is numeric, not a datecode. The display is only formatted to show what you want.
03-13-2014 11:37 AM
You can go to the Data Entry tab in the control properties and change the increment of the control to 60 and see if that satisfies your need.
03-13-2014 11:41 AM
Aputman,
Changing the increment had no effect I'm afraid. I guess I'll have to use the multi-control work-around with event handlers.
Thanks,
Erik
03-13-2014 11:45 AM
If i set increment to 60, when i highlight the hours, the minutes increment. When i highlight the minutes, the seconds increment.....both by 1
03-13-2014 11:51 AM
As do I - except I still can't get the days to increment. It's like it was a feature that was added but only partially tested. I've also tried using the format %<%H:%M:%S>t and settingt he Incement back to 1, and that doesn't work completely either.
03-13-2014 11:51 AM - edited 03-13-2014 11:58 AM
03-13-2014 04:56 PM - edited 03-13-2014 04:57 PM
Took an hour and built a work-around for the issue. Wasn't as bad as I originally estimated, though found curious differences between the control terminal, local variables and the Value property - namely, the Value property has the post-event value, while the others have the pre-event value for the control. Still, this works for my application.
This version is in LV 2010 SP1, which is as far back as I can go.
03-13-2014 05:19 PM
I don't know how to do it but this would be the perfect candidate for an X-Control. That way you don't have this unnecessary code on your BD.
03-13-2014 05:54 PM
@ErikL68 wrote:
- namely, the Value property has the post-event value, while the others have the pre-event value for the control. Still, this works for my application.
I probably would use value changed events instead, e.g. as attached.