KeyPressed Woes with Buttons in Container Controls

KeyPressed events work fine in a TextField tha has focus in a container control, but refuses to work for me when a button has focus in a container control. My challenge is to be able to trigger either an OK button or Cancel Button, (Enter or Esc), when a barcode has been scanned into a text field. If the barcode text passes a session database query test triggered by the TextChange event, the OK button gets the focus. The user then needs to n decide to accept the scanned code by pressing enter or cancelling by pressing Esc. No matter where I put the Keypressed event it doesn’t fire when the OK button has focus.

After searching the forum I’ve found a lot of people having KeyPressed issues, some which have been solved by using JavaScript, but none of them I’ve found are trying to trigger an action, or at least me being cluelesss about using Javascript, I have been unsuccessful in making work for me as an alternative. This one by Michel Bujardet, KeyPressed event issues, looked promising but trying to use the hashtag change only works once and will not work again until the hashtag gets changed to something else. Simply reading a barcode from a gun that has an enter included screws that up for capturing enter when the button gets focus. Alternatively this one by Albin Kiland, Capturing keys in web textfield, looks promising but I’m unsure how to modify it to trigger a Session.Method when the KeyPressed event occurs while a button control has focus.

I’m open to any ideas on how to implement my need or any other solutions to make KeyPressed trigger on Enter or Esc. Oh, the standard browser used in our environment is Chrome on Windows which is what I primarily develop for.