Fabian1648 2 Posted October 26, 2020 Hi, Imagine an Android app developed with Delphi Rio that is connected to an external BlueTooth device (tests performed with barcode reader and keyboard). When a Carriage Return (CR) is sent, the app triggers a "FormKeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);" event. So the CR is detected! If I use an Android text editor, the CR is taken into account. But it's impossible to identify the CR character in the Delphi "FormKeyDown" event: an "Ord(KeyChar)" which should give a #13 (and which gives #13 if you compile for windows) gives 0, a "LEncoding.GetBytes(KeyChar)" also gives 0; Same for the keyboard keys Backspace, Enter, Ctrl, Alt, Shift, Caps, F1...F12, Insert, Home, PgUp, Delete, End, PgDn, ..... which all give '0'! A question arises... How to identify the arrival of a CR or other non-alphanumeric character? Share this post Link to post
Alexander Bunakov 0 Posted October 26, 2020 Hello, You should override form's KeyDown virtual method: type TForm1 = class(TForm) procedure KeyDown(var Key: Word; var KeyChar: System.WideChar; Shift: TShiftState); override; ... Search local help for FMX.Forms.TCommonCustomForm.KeyDown. Share this post Link to post