IDE.LicenseKeyForm.pas 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. unit IDE.LicenseKeyForm;
  2. {
  3. Inno Setup
  4. Copyright (C) 1997-2025 Jordan Russell
  5. Portions by Martijn Laan
  6. For conditions of distribution and use, see LICENSE.TXT.
  7. Compiler IDE license key form
  8. }
  9. interface
  10. uses
  11. Classes, Controls, StdCtrls, UIStateForm;
  12. type
  13. TLicenseKeyForm = class(TUIStateForm)
  14. CancelButton: TButton;
  15. GroupBox1: TGroupBox;
  16. LicenseKeyMemo: TMemo;
  17. procedure FormCreate(Sender: TObject);
  18. procedure LicenseKeyMemoChange(Sender: TObject);
  19. procedure LicenseKeyMemoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  20. end;
  21. implementation
  22. {$R *.DFM}
  23. uses
  24. Windows, Shared.LicenseFunc, IDE.HelperFunc;
  25. procedure TLicenseKeyForm.FormCreate(Sender: TObject);
  26. begin
  27. InitFormFont(Self);
  28. InitFormTheme(Self);
  29. LicenseKeyMemo.Font.Name := GetPreferredMemoFont;
  30. LicenseKeyMemo.Font.Size := 10;
  31. end;
  32. procedure TLicenseKeyForm.LicenseKeyMemoChange(Sender: TObject);
  33. begin
  34. var License: TLicense;
  35. if ParseLicenseKey(LicenseKeyMemo.Text, License) then begin
  36. UpdateLicense(License);
  37. ModalResult := mrOk;
  38. end;
  39. end;
  40. procedure TLicenseKeyForm.LicenseKeyMemoKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  41. begin
  42. if Key = VK_ESCAPE then
  43. Close;
  44. end;
  45. end.