Enter Key in TEdit lazarus / 10-Designer ---------------------------------------------------------------------- raturney@houston.rr.com · 2005-07-22 05:12 I am using a TEdit control to enter a decimal number, press "Enter", shift the focus to the next TEdit control to enter another number.  I have written code that works, but only if I press "Ctrl-Enter" instead of "Enter". I thought #13 was the code for carraige return/enter key.  If so, why does this only work using "Ctrl-Enter"?  Any ideas would be appreciated. Thanks, Bob Code: [Select] procedure TfrmPV.edtODKeyPress(Sender: TObject; var Key: char); begin    with Sender as TEdit do    ShowMessage('Begin');    case Key of    '0'..'9' : ShowMessage('0-9 was pressed.');    '.', ',' : ShowMessage('Period or Comma was pressed.');    #8 :  ;    #13 : begin             ShowMessage('#13 was pressed.');             Panel1.SelectNext(Sender as TWinControl, True, True);             Key := #0;          end;    #10 : begin             Panel1.SelectNext(Sender as TWinControl, True, True);             Key := #0;          end;    else          Key := #0;    end; end; ---------------------------------------------------------------------- Marc · 2005-07-22 12:13 Try als keydown and keyup events. I'm not sure if #10 and/or #13 are pased to keypress ---------------------------------------------------------------------- Anonymous · 2005-07-22 13:49 Thank you very much, that worked! -Bob Code: [Select]procedure TfrmPV.edtODKeyPress(Sender: TObject; var Key: char); begin    case Key of    '0'..'9' : ShowMessage('0-9 was pressed.');    '.', ',' : ShowMessage('Period or Comma was pressed.');    else       Key := #0;    end; end; procedure TfrmPV.edtODKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); begin    if Chr(Key) = #13 Then      begin         ShowMessage('#13 was pressed.');         Panel1.SelectNext(Sender as TWinControl, True, True);      end; end; ---------------------------------------------------------------------- Marc · 2005-07-25 13:58 In KeyDown and Keyup events, better check with the VirtualKeycodes like VK_RETURN, VK_TAB etc. then using Chr(Key). (a virtual kay can be larger than 255) ---------------------------------------------------------------------- Anonymous · 2005-07-27 13:02 I have noticed that using the code listed above, that the Key values for entries from the "Keypad" (the keys on the far right side of the keyboard) are not processed.  Although the numbers entered from the top row are processed.  I noticed this after setting up a way to count the number of "periods/decimal points" entered.  The "period was detected when entered from the standard part of the keyboard, but was not seen when entered from the "keypad" on the far right side of the keyboard and was allowed to pass through the event handler.  Any ideas on this? I have been looking for information to see if the  key codes for the "Keypad" are different from the ones returned from the top row.  Maybe the "VK_" codes are the answer.  I don't know where to find a listing of them.  Would Delphi documentation have the list of these codes? Thanks, -Bob ---------------------------------------------------------------------- Marc · 2005-08-05 10:04 Have a look at http://msdn.microsoft.com/library/default.asp?url=/library/en- us/winui/winui/WindowsUserInterface/UserInput/VirtualKeyCodes.asp ---------------------------------------------------------------------- Anonymous · 2005-08-05 12:57 Thanks for link (and help).  I'll have a look. -Bob