The Delphi Bug List

Visual Component Library (VCL)

Samples


The color codes indicate in which version(s) of Delphi the bug occurs and what its status is.
Latest update: 1 April 1998
Bug # Delphi versions Description
82 1.02 2.01 3.0 3.01 3.02 4.0 4.01 4.02 TSpinEdit
Control will not correctly process ENTER and ESC keys in dialogs.

Bug #82; last modified: before April 1998
1.02 2.01 3.0 3.01 3.02 4.0 4.01 4.02
Exists Unknown Unknown Unknown Unknown Unknown Unknown Unknown
Samples - TSpinEdit

Control will not correctly process ENTER and ESC keys in dialogs.

Description
If a TSpinEdit control has focus in a dialog, pressing ESC will not cancel the dialog (if there is a cancel button), and pressing ENTER will not process the default button (if there is a default button). Standard UI for Windows dialogs dictates that the ENTER be treated as the OK button and ESC as the Cancel button. TSpinEdit prevents this behavior.
Solution / workaround
For some reason, the style ES_MULTILINE is set for this control when it is created. The control is never a multi-line control, so I have no idea why this is done. However, it is the root of this problem. To fix it, simply create a new TSpinEdit descendant and override the CreateParams method so that it does the following:
procedure TSpinEditFix.CreateParams(Params: TCreateParams);

begin

  inherited CreateParams(Params);

  Params.Style := Params.Style and not ES_MULTILINE;

end;

Index page
The Delphi Bug Lists are maintained by Reinier Sterkenburg, with help from the DeBug Team.
All feedback is appreciated. See also the feedback section of the Delphi Bug List home page.