For the record, this should work. However, it looks like TSpinEdit has an error. Since TSpinEdit is a sample (Vcl.Samples.Spin.pas, pay attention to "Samples"), you can fix it yourself.
In TSpinEdit, add the following method declaration only after WMCut:
procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE;
Complete the class (Shift + Ctrl + C) and add the following code to WMGetDlgCode:
procedure TSpinEdit.WMGetDlgCode(var Message: TWMGetDlgCode); begin inherited; Message.Result := Message.Result and not DLGC_WANTALLKEYS; end;
This tells VCL that the edit control does not want to process the Enter and Escape keys (VK_ENTER, VK_ESCAPE). Since it does not process keys, they will be redirected to buttons, which will then be called by the base according to their settings (by default and Cancel).
Feel free to report this to Quality Central
Allen bauer
source share