LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Numeric Control: disable textbox entry in order to use in/decrement buttons only?

Hello there,
 
Is there a way to disable editing of the textbox in a numeric control so that the user can only see the value when he uses the in/decrement buttons?
 
I know this could be achieved by using an numeric indicator and two buttons in a while loop. However I run into problems when I use this approach together with my event loop. Therefore I thought there might be an easier way by doing it directly with a numeric control. Is this possible? Thanks for your help.
0 Kudos
Message 1 of 4
(3,070 Views)
One simple solution is to create a "flat box" style decoration object, paint it transparent, and resize/move it to exactly cover the textbox portion of the control.  You would also want to check the "Skip this control when tabbing" box in the Key Navigation dialog for the control so that the user can't access it by tabbing.

Good luck,
John


0 Kudos
Message 2 of 4
(3,059 Views)

Here's a couple of other things you could try.  One would be to create a Numeric Indicator and put it directly over the Numeric control, but leave the inc/dec buttons visible.  On your diagram, just wire the Control terminal directly to the indicator terminal in a Value Change event case for the control.  This essentially accomplishes what you want, and gives you the added benefit of allowing the user to highlight the value in the indicator (if he wants to copy/paste it, e.g.), but not allowing him to change the value.

Another slick thing you can do would be to have a Mouse Move event configured on the control, and whenever the mouse moves within the rect defined by the inc/dec buttons, enable the control.  But if you get a Mouse Move event on the control and the coordinates are not inside this rect, disable the control.

Rock on,
-D

0 Kudos
Message 3 of 4
(3,053 Views)
Thanks guys. The covering of the control with the indicator works a treat for me. I really appreciate your feedback. It made my code a lot simpler (almost beautiful Smiley Happy).
0 Kudos
Message 4 of 4
(3,042 Views)