- Krishna Mohan Gullap
- PowerBuilder
- Tuesday, 17 November 2020 07:46 PM UTC
Hello All -
One of the requirements from my client is that he needs to restrict certain fields in a datawindow from being altered manually. He wants to have them populated using a scanner and disallow manual entry
So, I did something like this in an user-defined event mapped to pbm_dwnkey
KeyDown event (Mapped to pbm_dwnkey):
Get the old value stored in the DW column from the Primary Buffer (The changes would not take effect unless they press tab)
if user presses any key (alphabets/numerals) then
Restore the value from the primary buffer
Pass the control on to the next editable field
End If
As long as the user tries to edit these restricted fields using the keyboard, everything works perfectly fine. But, when the user does a scan of, say 10 characters from a barcode, the above KeyDown event gets triggered automatically 10 times (probably since it's a keyboard wedge scanner and acts pretty much like a keyboard)
Now, the challenge is that I don't have a way to distinguish if the key character to the above event came from the action where a user presses a key or from the scanner
Can you experts help in this situation? Is there another in-built pbm* datawindow event that I can make use of? Or is there an Windows API call that I can make to see if the keyboard was used to send that key? Any suggestions are greatly appreciated !!!
Thanks,
Krishna
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.