home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 March / Chip_1998-03_cd.bin / zkuste / delphi / WhiteAnts / CONTSTRM.ZIP / Editfrm.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-01-09  |  1.9 KB  |  96 lines

  1. unit EDITFRM;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   StdCtrls, ExtCtrls, Forms, Buttons, Spin, StrmSamp;
  8.  
  9. type
  10.   TSampleForm = class (TForm)
  11.     Bevel1: TBevel;
  12.     CancelBtn: TBitBtn;
  13.     Label1: TLabel;
  14.     Label2: TLabel;
  15.     SampleNameEdit: TEdit;
  16.     OKBtn: TBitBtn;
  17.     ValueEdit: TSpinEdit;
  18.     procedure FormCreate(Sender: TObject);
  19.   private
  20.     FSample: TSample;
  21.   protected
  22.     function GetSampleName: String;
  23.     function GetValue: LongInt;
  24.     procedure SetSampleName(Value: String);
  25.     procedure SetSample(AValue: TSample);
  26.     procedure SetValue(Value: LongInt);
  27.   public
  28.     function Execute: Boolean;
  29.     property SampleName: String read GetSampleName write SetSampleName;
  30.     property Sample: TSample read FSample write SetSample;
  31.     property Value: LongInt read GetValue write SetValue;
  32.   end;
  33.  
  34.  
  35.  
  36. var
  37.   SampleForm: TSampleForm;
  38.  
  39. implementation
  40.  
  41. uses
  42.   NumUtils;
  43.  
  44. {$R *.DFM}
  45.  
  46.  
  47. {
  48. ********************************* TSampleForm **********************************
  49. }
  50. function TSampleForm.Execute: Boolean;
  51. begin
  52.   Result := (ShowModal = mrOk) and Assigned(FSample);
  53.   if Result then
  54.   begin
  55.     FSample.Name := SampleName;
  56.     FSample.Value := Value;
  57.   end;
  58. end;
  59.  
  60. function TSampleForm.GetSampleName: String;
  61. begin
  62.   Result := SampleNameEdit.Text;
  63. end;
  64.  
  65. function TSampleForm.GetValue: LongInt;
  66. begin
  67.   Result := ValueEdit.Value;
  68. end;
  69.  
  70. procedure TSampleForm.SetSampleName(Value: String);
  71. begin
  72.   SampleNameEdit.Text := Value;
  73. end;
  74.  
  75. procedure TSampleForm.SetSample(AValue: TSample);
  76. begin
  77.   FSample := AValue;
  78.   if Assigned(FSample) then
  79.   begin
  80.     SampleName := FSample.Name;
  81.     Value := FSample.Value;
  82.   end;
  83. end;
  84.  
  85. procedure TSampleForm.SetValue(Value: LongInt);
  86. begin
  87.   ValueEdit.Value := Value;
  88. end;
  89.  
  90. procedure TSampleForm.FormCreate(Sender: TObject);
  91. begin
  92.   Font.Size := Font.Size;
  93. end;
  94.  
  95. end.
  96.