Autore Topic: Come intercettare un codice a barre "Enter"  (Letto 415 volte)

Offline vuott

  • Moderatore globale
  • Senatore Gambero
  • *****
  • Post: 11.725
  • Ne mors quidem nos iunget
    • Mostra profilo
Come intercettare un codice a barre "Enter"
« il: 08 Ottobre 2014, 23:31:47 »
Vi riporto questa discussione:


" When reading bar-codes the gun adds an "Enter" at the end. In a spreadsheet
if the focus was on cell A1 once the bar-code is read the focus will be in
cell A2 as if "Enter" had been pressed.

Codice: gambas [Seleziona]
....
CatchBarcodeEnter = Key.Code
If Key.Code = Key.Enter Or CatchBarcodeEnter = 65293 Then
....

It does not work without the 65293 part.

This is not recommended as we are warned: -

"Never compare the value of this property with a numeric constant, because
the key codes may depend on the underlying toolkit. Always use the constants
defined in this class!"

Do you know how I might get around this?

Thanks,

Charlie



" 65293 is Key.Return. If you don't want to check both keys (one is the
main keyboard, the other is for the numeric pad), just compare Key.Text with "\n".

Regards,
--
Benoît Minisini
"
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »