123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- unit setmaximumformunit;
- interface
- uses
- Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Spin,
- ButtonPanel, LCLTranslator;
- type
-
- TSetMaximumForm = class(TForm)
- DecisionButtonPanel: TButtonPanel;
- MaximumLabel: TLabel;
- MaximumSpinEdit: TSpinEdit;
- procedure CancelButtonClick(Sender: TObject);
- procedure OKButtonClick(Sender: TObject);
- private
- ResultValue: Integer;
- public
- function RequestValue(OriginalValue: Integer; MaxValue: Integer = 999): Integer;
- end;
- var
- SetMaximumForm: TSetMaximumForm;
- implementation
- procedure TSetMaximumForm.OKButtonClick(Sender: TObject);
- begin
- ResultValue := MaximumSpinEdit.Value;
- Close;
- end;
- procedure TSetMaximumForm.CancelButtonClick(Sender: TObject);
- begin
- Close;
- end;
- function TSetMaximumForm.RequestValue(OriginalValue: Integer; MaxValue: Integer
- ): Integer;
- begin
- ResultValue := OriginalValue;
- MaximumSpinEdit.MaxValue := MaxValue;
- MaximumSpinEdit.Value := OriginalValue;
- ShowModal;
- RequestValue := ResultValue;
- end;
- end.
|