1. Krishna Mohan Gullap
  2. PowerBuilder
  3. Tuesday, 17 November 2020 19: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

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 17 November 2020 20:06 PM UTC
  2. PowerBuilder
  3. # 1

Hi Krishna;

  I suspect that it just sends keyboard messages to the current keyboard buffer. So it might make it very hard to discern where the keyboard input actually cam from.

  I have used other types of scanners with PB Apps and they had the option to place the scanned data into the clipboard where the PB App could then use to do a proper SetItem() into the DWO's primary buffer directly. Does your scanner have that feature?

Regards ... Chris

Comment
  1. Krishna Mohan Gullap
  2. Wednesday, 30 June 2021 14:33 PM UTC
This can't get more complicated :-)
  1. Helpful
  1. Krishna Mohan Gullap
  2. Wednesday, 30 June 2021 16:23 PM UTC
So, a driver API call in the sense, like a DLL function which we can use to obtain the scan word, correct?
  1. Helpful
  1. mike S
  2. Wednesday, 30 June 2021 16:36 PM UTC
typically scanners either are setup as keyboard wedge or as serial devices (usb/bluetooth). you would need to read the com port
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.