LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disable Numeric Control Increment/Decrement with arrow keys?

Solved!
Go to solution

Is there a way to disable the increment/decrement for numeric controls from the arrow keys? I have an array of scale factors that I don't want the arrow keys to increment/decrement the scale factor if the user tries to navigate with the up/down keys.

0 Kudos
Message 1 of 10
(3,394 Views)
Solution
Accepted by topic author adekruif

You could use a Key Down? event for the controls and discard the event if it happens to be an up or down arryw.

Message 2 of 10
(3,376 Views)

You may also hide the arrows: just open the control's context menu and uncheck Visible Items -> Increment/Decrement.

There's a Control property to do this programatically, too.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 3 of 10
(3,309 Views)

@pincpanter wrote:

You may also hide the arrows: just open the control's context menu and uncheck Visible Items -> Increment/Decrement.


That does not affect the keyboard arrow keys, which is what I think the OP is asking about.  But I still disable the Increment/Decrement arrows in all of my UI.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 10
(3,281 Views)

@crossrulz  ha scritto:

@pincpanter wrote:

You may also hide the arrows: just open the control's context menu and uncheck Visible Items -> Increment/Decrement.


That does not affect the keyboard arrow keys, which is what I think the OP is asking about.  But I still disable the Increment/Decrement arrows in all of my UI.


You're right. I misinterpreted the OP request.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 5 of 10
(3,269 Views)

If you have an event case and check for Key Down you can at least set a flag to undo the next event, which will be the Change Value.

 

snip.png

0 Kudos
Message 6 of 10
(3,264 Views)
Solution
Accepted by topic author adekruif

Hi Ramon,

 

no need to store a flag when you use a filter event (like "KeyDown?") and discard the event for "unwanted" keys:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 10
(3,257 Views)

@GerdW wrote:

Hi Ramon,

 

no need to store a flag when you use a filter event (like "KeyDown?") and discard the event for "unwanted" keys:

check.png


This is what I was trying to accomplish but couldn't get it to work as intended without the discard filter. I hadn't filtered anything before so I didn't know the option was available. Thanks everyone for the help!!

0 Kudos
Message 8 of 10
(3,238 Views)

Hi Gerd,

I forgot about that option, which is even better. However for me the "KeyDown?" event does not seem to be triggered on an array of numerics like the OP was asking for.

0 Kudos
Message 9 of 10
(3,227 Views)

@RamonG  ha scritto:

Hi Gerd,

I forgot about that option, which is even better. However for me the "KeyDown?" event does not seem to be triggered on an array of numerics like the OP was asking for.


In case you have an array, you need to register the event with the Array Element reference:

example.png

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 10 of 10
(3,201 Views)