Capturing a Key press
polonious
Member Posts: 64
Hi,
I have a text field that I would like to prevent typing/pasting into, but allow a scanner to scan a barcode into it. Is there a way I can tell if a key on the keyboard has been pressed so I can error out and prevent it, but if the user scans a barcode the barcode will appear in the text box?
Thanks.
I have a text field that I would like to prevent typing/pasting into, but allow a scanner to scan a barcode into it. Is there a way I can tell if a key on the keyboard has been pressed so I can error out and prevent it, but if the user scans a barcode the barcode will appear in the text box?
Thanks.
0
Comments
-
interesting.. but I think a scanner "Y"ed into the keyboard port simply acts as a keyboard.
simply making the entry of the number or code easier.
My vote would lean towards no, but maybe someone else has a diff view?0 -
Hopefully! It's a tricky one!0
-
Don't know the specifics of your program, so just throwing out ideas.
In the OnInputChange trigger you could use SendKeys to send a TAB. Technically if the user really wanted to change it they still could. Also wouldn't work if the device sent one key press at a time.
Could you have another field / global variable that the device fills in? This field wouldn't be displayed on the form, and the real field would not be editable.
A shortcut key on the form that starts up "Scan Mode" so that it knows the next input it receives goes to that field.
Who knows, none of them probably work, but brainstorming is fun :P0 -
polonious wrote:Hi,
I have a text field that I would like to prevent typing/pasting into, but allow a scanner to scan a barcode into it. Is there a way I can tell if a key on the keyboard has been pressed so I can error out and prevent it, but if the user scans a barcode the barcode will appear in the text box?
Thanks.
Why would you want to prevent this? There are quite a lot of scenarios when for some strange reason scanners might not work (cold environments, bad bar code quality/design/colours) and then user will be forced to enter details manually.Tomas,
Dynamics NAV Enthusiast0 -
Cheers fella's...
matttrax - you might be on to something there with the hidden field and scan button, might look into that further, cheers.
Tomas - yeh valid points mate, but this is a password field for which all users have a staff card with the password barcoded onto it. Problem is, some were clever enough to scan their card into notepad and are now sharing their passwords with others. So thats all going to be disabled now, but I also want to stop them from typing into that field altogether just in case.0 -
polonious wrote:Problem is, some were clever enough to scan their card into notepad and are now sharing their passwords with others.
hehe, hey at least, you have bright people working in the company
Tomas,
Dynamics NAV Enthusiast0 -
You can do a timer on the field. So if the next character is not entered within 0.0001 seconds, make the field not editable.
Don't know if this would work though, never tried it.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
Not a bad idea, but impossible to troubleshoot. You want to try to debug a form that fires a timer event every 1/1000 of a second? I wonder what happens to the computer's performance, CPU usage would probably go through the roof.0
-
Hi,
Would it be possible to add a special character to the beginning of barcode.
This way when the user starts entering information through the keyboard, you can scan for that character to be entered first and if it is not correct, error out.
It is not completely fireproof, but hey it is an idea,
have fun,
regards,
WillyFostering a homeless, abused child is the hardest yet most rewarding thing I have ever done.0 -
That's an Idea..what if your scan card had a leading char that doesn't exist on normal keyboards.
:-k0 -
1. Scan onto the notepad
2. Copy and paste to the field
broken...
Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
=D> Arrgh!
Delete nopepad & wordpad & all Pads!!!!! :^o Just kidding
he does mention something about covering that part..scan their card into notepad and are now sharing their passwords with others. So thats all going to be disabled now
Isn't there a post somewhere about not allowing pasting?0 -
Or if it's possible to change the solution to be login based instead of password based...Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
Move to thumbprint readers, that would fix it. Just half jokingpolonious wrote:Cheers fella's...
matttrax - you might be on to something there with the hidden field and scan button, might look into that further, cheers.
Tomas - yeh valid points mate, but this is a password field for which all users have a staff card with the password barcoded onto it. Problem is, some were clever enough to scan their card into notepad and are now sharing their passwords with others. So thats all going to be disabled now, but I also want to stop them from typing into that field altogether just in case.0 -
Yeh notepad/wordpad etc. will be gone so that won't be a problem. However with 350+ staff cards already issued, not sure the business will want to reprint them all with changed passwords (i.e with special leading characters!)!
Thumbreaders! nice idea!0 -
Right, so I'm going to give Alex Chow's idea a go. I'm going to start a timer when the first key is pressed, then within half a second or so it will try validating the password. It will give enough time for the scanner to work, but not enough time for the user to type the password. I hope!!!0
-
Result!
For anyone interested... By using the OnInputChange() and OnAfterInput() triggers on the text field, I am capturing the length of time it takes for the user to enter the password. OnInputChange() starts the timer, and then OnAfterInput() stops the timer, giving me the elapsed time. If it takes longer than half a second, it's erroring out, otherwise it will login as usual. This gives enough time for the scanner to scan the password, but not enough time to type it in (no matter how good your touch-typing is!!!).
Thanks for the assistance lads!0 -
Users could still paste it in though right? Type the password in notepad, copy it, paste it into the field in NAV.0
-
Nope! See my post from earlier, Notepad/Wordpad etc are all disabled on the machines...0
-
-
polonious wrote:Nope! See my post from earlier, Notepad/Wordpad etc are all disabled on the machines...
do the machines have email? copy paste can be done with many profgrams not just Notepad & Word Pad0 -
Nope, the only running program is Navision. Everything else is either disabled or uninstalled.0
-
Love it! I'm sure if the user really tries, he/she will find ways around it, but this will definately prevent a majority of the people from entering other people's PW.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
agree you found a programming solution to a people problem. In my company, if employee was trading passwords to get access to info they shouldn't have, I couldn't trust them and they would be terminated. With the current job market, I am pretty confident I could find an honest replacementAlex Chow wrote:Love it! I'm sure if the user really tries, he/she will find ways around it, but this will definately prevent a majority of the people from entering other people's PW.0 -
polonious wrote:Nope, the only running program is Navision. Everything else is either disabled or uninstalled.
The user can hit F1 and use the search box to copy and paste.0 -
The can use file database Open Text box to do copy and paste.
They can click on Start Run and use copy and paste.
They can do Ctrl+F and use the find dialog to copy and paste.0 -
-
what you need is an automation that has an event for a card reader. You cannot use wedge card reader.0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions



