LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mask when inputting data

Solved!
Go to solution

Hi, I`m having a brain freeze and need some help.

 

I need to create an input mask on a text box so that when someone enters a serial number they can only input nnnn-nn-nn where n is equal to a number. I have wrote a quick vi that checks that only a number is being entered and not characters but i want to add the "-" after the first 4 numbers have been entered and again after the next two numbers have been entered.

 

Any help would gratefully recieved.

 

Cheers

 

James

0 Kudos
Message 1 of 6
(3,098 Views)

Have a look at this thread at LAVA.

 

I posted an example that does exactly what you want.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 2 of 6
(3,090 Views)
This may also be a solution. It is in god windows style and look profesional


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 3 of 6
(3,081 Views)

Personally, I would make the control an indicator and fill the numbers into a U8 array of size=8 according to "mouse down" events. The dashes can be added programmatically whenever the string display is updated. Pressing backspace would delete the latest element by editing the array.

 

Here is a very crude example (LV8.5) that shows the main idea.

 

 

 

(The insert cursor is irrelevant here and a bit distracting. To hide it, you could disable the control and use FP mouse down events. To see if you are over the control, add a boolean state in another shift register and switch it according to mouse enter/mouse leave.)

Message Edited by altenbach on 12-06-2008 01:06 PM
Download All
Message 4 of 6
(3,064 Views)
Solution
Accepted by topic author Treble20

altenbach wrote:

Personally, I would make the control an indicator and fill the numbers into a U8 array of size=8 according to "mouse down" events.


Sorry, of course I meant "key down" events as will be obvious from the code picture. 😄

Message 5 of 6
(3,058 Views)

Brilliant, thanks very much for the help this will help just fine, I had a massive brain freeze yesterday.

 

Cheers

 

James

0 Kudos
Message 6 of 6
(3,035 Views)