12-06-2008 10:18 AM
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
Solved! Go to Solution.
12-06-2008 11:07 AM
Have a look at this thread at LAVA.
I posted an example that does exactly what you want.
Ton
12-06-2008 12:19 PM
12-06-2008 03:06 PM - edited 12-06-2008 03:06 PM
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.)
12-06-2008 03:22 PM
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. 😄
12-07-2008 05:06 AM
Brilliant, thanks very much for the help this will help just fine, I had a massive brain freeze yesterday.
Cheers
James