ScCustomSetErrorFrm.pas 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. unit ScCustomSetErrorFrm;
  2. interface
  3. uses
  4. Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  5. Dialogs, StdCtrls, ExtCtrls, ConstVarUnit;
  6. type
  7. TScCustomSetErrorForm = class(TForm)
  8. Label1: TLabel;
  9. Label2: TLabel;
  10. lbl1: TLabel;
  11. edtLostLineCount: TEdit;
  12. edtStdMark: TEdit;
  13. edtDeductMark: TEdit;
  14. Bevel1: TBevel;
  15. btnOK: TButton;
  16. btnCancel: TButton;
  17. rbLostPre: TRadioButton;
  18. rbLostChild: TRadioButton;
  19. rbLostNext: TRadioButton;
  20. procedure edtLostLineCountKeyPress(Sender: TObject; var Key: Char);
  21. procedure edtLostLineCountChange(Sender: TObject);
  22. private
  23. { Private declarations }
  24. public
  25. { Public declarations }
  26. end;
  27. function ExecCustomSetErrorForm(var LostKind: TErrorCategory; var LostCount: Integer): Boolean;
  28. implementation
  29. {$R *.dfm}
  30. function ExecCustomSetErrorForm(var LostKind: TErrorCategory; var LostCount: Integer): Boolean;
  31. var
  32. ScCSEForm: TScCustomSetErrorForm;
  33. begin
  34. Result := False;
  35. ScCSEForm := TScCustomSetErrorForm.Create(nil);
  36. try
  37. with ScCSEForm do
  38. begin
  39. ShowModal;
  40. if ModalResult = mrOK then
  41. begin
  42. if rbLostPre.Checked then
  43. LostKind := ecLostPreSibling
  44. else if rbLostChild.Checked then
  45. LostKind := ecLostChildren
  46. else if rbLostNext.Checked then
  47. LostKind := ecLostNextSibling;
  48. LostCount := StrToInt(edtLostLineCount.Text);
  49. Result := True;
  50. end;
  51. end;
  52. finally
  53. ScCSEForm.Free;
  54. end;
  55. end;
  56. procedure TScCustomSetErrorForm.edtLostLineCountKeyPress(Sender: TObject;
  57. var Key: Char);
  58. begin
  59. if not (Key in ['0'..'9', #8, #13]) then
  60. Key := #0;
  61. end;
  62. procedure TScCustomSetErrorForm.edtLostLineCountChange(Sender: TObject);
  63. begin
  64. edtDeductMark.Text := edtLostLineCount.Text;
  65. end;
  66. end.