LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Weird Digital Display Key Down events

(Using LV 8.51)

I have a slider with the digital display shown.  The slider is restricted to 0-50 (I32)  I want the user to be able to type 0-50 in the digital display only.  I have formated the display as %2d and set all limits.  The display allows the user to type any arbitrary number of characters as well an many letters.  I figured out the random letters are the allowable numeric prefixas such as k (for kilo).  I need to not allow the user to type anything in the numeric display except [0-9][0-9].  I figured that I could filter the key down? event.  This did not work.  I placed the key down? event and the key down immediatly restricted the typing to a single character.  What did I do wrong or is this a bug.  Is thare a simpler way of restrictin g the imput (NOT Coersing which is done on the data but limit the input characters).  Thanks I am stuck on this one.

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 1 of 7
(3,199 Views)
By default, filtering event don't discards the incomming event. You could
wire a false constant to the discard output of the event. The next step is
to check which key is pressed, and discard the output if it isn't 0-9.

It's hard to give more advice without seeing any code. You are probably
doing something wrong...

Regards,

Wiebe.


0 Kudos
Message 2 of 7
(3,183 Views)
I hope I am doing something wrong but I dont see it.  It seems that independent of registering for the keydown event the action of the slider changes.  I have attached an example.
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 3 of 7
(3,172 Views)
That is weird, and if you'd ask me it is a bug.

There isn't anything wrong with your logic, and it works just fine for a
normal numeric control.

I'm still toying with it, but the only way around it seems to be to use a
seperate numeric and slider. Then, update the slider when the numeric gives
a value change event, and update the numeric when the slider gives one...

Regards,

Wiebe.


0 Kudos
Message 4 of 7
(3,156 Views)
Ok, here is another solution, that doesn't result in codebloat...

Don't laught, it is a silly solution.

Select the slider.
From the edit menu, select customize control.
Replace the digital display (the numeric on the right) with another slider!
On this slider, show the digital display.
Optinally, remove the second slider's scale, and shrink and move it until it
isn't visible.
Optinally, store the control.

Now, the digital display acts like it should. It's hacking, but it works.

Regards,

Wiebe.


Message 5 of 7
(3,153 Views)
Thanks for the help.  Id does seem like a bug to me.  I will customize the control and give this a try.  There really should be a property to control input to numerics such as dont allow non numerics and limit number of characters.  I have built a string X control to do this but X controls are way too much work and I always end up with a buggy control in the end.  I have since convinced the end user to ignore non numeric inputs and I coerse the value anyway so I might be able to ignore this bug. 
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 6 of 7
(3,139 Views)

Hi falkpl,

 

This was reported to R&D (# 143927) for further investigation. Thanks for the feedback!

 

Regards,

Stephen S.
National Instruments
Applications Engineering
0 Kudos
Message 7 of 7
(3,113 Views)