unit ScCustomSetErrorFrm; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ConstVarUnit; type TScCustomSetErrorForm = class(TForm) Label1: TLabel; Label2: TLabel; lbl1: TLabel; edtLostLineCount: TEdit; edtStdMark: TEdit; edtDeductMark: TEdit; Bevel1: TBevel; btnOK: TButton; btnCancel: TButton; rbLostPre: TRadioButton; rbLostChild: TRadioButton; rbLostNext: TRadioButton; procedure edtLostLineCountKeyPress(Sender: TObject; var Key: Char); procedure edtLostLineCountChange(Sender: TObject); private { Private declarations } public { Public declarations } end; function ExecCustomSetErrorForm(var LostKind: TErrorCategory; var LostCount: Integer): Boolean; implementation {$R *.dfm} function ExecCustomSetErrorForm(var LostKind: TErrorCategory; var LostCount: Integer): Boolean; var ScCSEForm: TScCustomSetErrorForm; begin Result := False; ScCSEForm := TScCustomSetErrorForm.Create(nil); try with ScCSEForm do begin ShowModal; if ModalResult = mrOK then begin if rbLostPre.Checked then LostKind := ecLostPreSibling else if rbLostChild.Checked then LostKind := ecLostChildren else if rbLostNext.Checked then LostKind := ecLostNextSibling; LostCount := StrToInt(edtLostLineCount.Text); Result := True; end; end; finally ScCSEForm.Free; end; end; procedure TScCustomSetErrorForm.edtLostLineCountKeyPress(Sender: TObject; var Key: Char); begin if not (Key in ['0'..'9', #8, #13]) then Key := #0; end; procedure TScCustomSetErrorForm.edtLostLineCountChange(Sender: TObject); begin edtDeductMark.Text := edtLostLineCount.Text; end; end.