home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Components / TEECHART / Src Code / AXMAXMIN.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-10-24  |  2.0 KB  |  87 lines

  1. {**********************************************}
  2. {   TAxisMaxMin Dialog Editor                  }
  3. {   Copyright (c) 1996-98 David Berneda        }
  4. {**********************************************}
  5. {$I teedefs.inc}
  6. unit AxMaxMin;
  7.  
  8. interface
  9.  
  10. uses
  11.   WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  12.   Forms, Dialogs, StdCtrls, Buttons, SysUtils;
  13.  
  14. type
  15.   TAxisMaxMin = class(TForm)
  16.     BitBtn1: TButton;
  17.     BitBtn2: TButton;
  18.     EMaximum: TEdit;
  19.     EMinimum: TEdit;
  20.     Label1: TLabel;
  21.     Label2: TLabel;
  22.     procedure FormShow(Sender: TObject);
  23.     procedure BitBtn1Click(Sender: TObject);
  24.     procedure BitBtn2Click(Sender: TObject);
  25.   private
  26.     { Private declarations }
  27.   public
  28.     { Public declarations }
  29.     IsDateTime : Boolean;
  30.     MaxMin     : Double;
  31.   end;
  32.  
  33. implementation
  34.  
  35. {$R *.DFM}
  36. Uses TeeProcs,TeeConst;
  37.  
  38. procedure TAxisMaxMin.FormShow(Sender: TObject);
  39. begin
  40.   Screen.Cursor:=crDefault;
  41.   if IsDateTime then
  42.   Begin
  43.     if MaxMin>=1 then EMaximum.Text:=DateToStr(MaxMin)
  44.                  else
  45.                  Begin
  46.                    Label1.Visible:=False;
  47.                    EMaximum.Visible:=False;
  48.                  end;
  49.     EMinimum.Text:=TimeToStr(MaxMin);
  50.   end
  51.   else
  52.   begin
  53.     EMaximum.Hint:='';
  54.     EMinimum.Hint:='';
  55.     Label1.Caption:=TeeMsg_AxisDlgValue;
  56.     EMaximum.Text:=FloatToStr(MaxMin);
  57.     Label2.Visible:=False;
  58.     EMinimum.Visible:=False;
  59.   end;
  60. end;
  61.  
  62. procedure TAxisMaxMin.BitBtn1Click(Sender: TObject);
  63. begin
  64.   try
  65.     if IsDateTime then
  66.     begin
  67.       if EMaximum.Visible then
  68.          MaxMin:=StrToDateTime(EMaximum.Text+' '+EMinimum.Text)
  69.       else
  70.          MaxMin:=StrToTime(EMinimum.Text);
  71.     end
  72.     else MaxMin:=StrToFloat(EMaximum.Text);
  73.     ModalResult:=mrOk;
  74.   except
  75.     on E:Exception do
  76.        ShowMessage(Format(TeeMsg_IncorrectMaxMinValue,[E.Message]));
  77.   end;
  78. end;
  79.  
  80. procedure TAxisMaxMin.BitBtn2Click(Sender: TObject);
  81. begin
  82.   ModalResult:=mrCancel;
  83. end;
  84.  
  85. end.
  86.  
  87.