LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Double Precision Numeric Control using D:H:M format has increment/decrement problem

Solved!
Go to solution

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

0 Kudos
Message 1 of 15
(3,260 Views)

It's because the underlying data is numeric, not a datecode.  The display is only formatted to show what you want. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 15
(3,249 Views)

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.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 15
(3,237 Views)

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

0 Kudos
Message 4 of 15
(3,232 Views)

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

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 15
(3,227 Views)

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.

0 Kudos
Message 6 of 15
(3,219 Views)

If you set the increment to 120 the minutes will change by 2 (when hours is selected but not when the day is selected?), by 86400 the days by 1, by 3600 the hours by 1. It is unrelated to the selection for these values but the behavior is strange when you set the increment to 1.

 

Ben64

0 Kudos
Message 7 of 15
(3,218 Views)
Solution
Accepted by topic author ErikL68

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.

 

0 Kudos
Message 8 of 15
(3,181 Views)

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.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 9 of 15
(3,169 Views)

@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.

0 Kudos
Message 10 of 15
(3,159 Views)