home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 September / Chip_2001-09_cd1.bin / zkuste / delphi / kolekce / d12345 / CHEMPLOT.ZIP / TPlot / PlotZoom.pas < prev    next >
Pascal/Delphi Source File  |  2001-06-01  |  4KB  |  145 lines

  1. unit PlotZoom;
  2.  
  3. {-----------------------------------------------------------------------------
  4. The contents of this file are subject to the Q Public License
  5. ("QPL"); you may not use this file except in compliance
  6. with the QPL. You may obtain a copy of the QPL from 
  7. the file QPL.html in this distribution, derived from:
  8.  
  9. http://www.trolltech.com/products/download/freelicense/license.html
  10.  
  11. The QPL prohibits development of proprietary software. 
  12. There is a Professional Version of this software available for this. 
  13. Contact sales@chemware.hypermart.net for more information.
  14.  
  15. Software distributed under the QPL is distributed on an "AS IS" basis,
  16. WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the QPL for
  17. the specific language governing rights and limitations under the QPL.
  18.  
  19. The Original Code is: Zoom.pas, released 12 September 2000.
  20.  
  21. The Initial Developer of the Original Code is Mat Ballard.
  22. Portions created by Mat Ballard are Copyright (C) 1999 Mat Ballard.
  23. Portions created by Microsoft are Copyright (C) 1998, 1999 Microsoft Corp.
  24. All Rights Reserved.
  25.  
  26. Contributor(s): Mat Ballard                 e-mail: mat.ballard@chemware.hypermart.net.
  27.  
  28. Last Modified: 02/25/2000
  29. Current Version: 2.00
  30.  
  31. You may retrieve the latest version of this file from:
  32.  
  33.         http://Chemware.hypermart.net/
  34.  
  35. This work was created with the Project JEDI VCL guidelines:
  36.  
  37.         http://www.delphi-jedi.org/Jedi:VCLVCL
  38.  
  39. in mind. 
  40.  
  41. Purpose:
  42. To facilitate user manipluation of the plot scale.
  43.  
  44. Known Issues:
  45. -----------------------------------------------------------------------------}
  46.  
  47. interface
  48.  
  49. uses
  50.   Classes, SysUtils,
  51. {$IFDEF WINDOWS}
  52.   WinTypes, WinProcs,  Buttons, Controls, Forms, Graphics, StdCtrls,
  53. {$ENDIF}
  54. {$IFDEF WIN32}
  55.   Windows,
  56.   Buttons, Controls, Forms, Graphics, StdCtrls,
  57. {$ENDIF}
  58. {$IFDEF LINUX}
  59.   QButtons, QControls, QForms, QGraphics, QStdCtrls,
  60. {$ENDIF}
  61.   Misc, Nedit;
  62.  
  63. type
  64.   TZoomForm = class(TForm)
  65.     BitBtn1: TBitBtn;
  66.     BitBtn2: TBitBtn;
  67.     ZoomBitBtn: TBitBtn;
  68.     Label1: TLabel;
  69.     Label2: TLabel;
  70.     Label3: TLabel;
  71.     Label4: TLabel;
  72.     XMinNEdit: TNEdit;
  73.     XMaxNEdit: TNEdit;
  74.     YMinNEdit: TNEdit;
  75.     YMaxNEdit: TNEdit;
  76.     procedure FormCreate(Sender: TObject);
  77.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  78.   private
  79.  
  80.   public
  81.  
  82.   end;
  83.  
  84. var
  85.   ZoomForm: TZoomForm;
  86.  
  87. implementation
  88.  
  89. {$R *.dfm}
  90.  
  91. {------------------------------------------------------------------------------
  92.     Procedure: TZoomForm.FormCreate
  93.   Description: standard FormCreate procedure
  94.        Author: Mat Ballard
  95.  Date created: 04/25/2000
  96. Date modified: 04/25/2000 by Mat Ballard
  97.       Purpose: sets the position
  98.  Known Issues:
  99.  ------------------------------------------------------------------------------}
  100. procedure TZoomForm.FormCreate(Sender: TObject);
  101. begin
  102.   SetDialogGeometry(Self, ZoomBitBtn, Label1.Left);
  103. end;
  104.  
  105. {------------------------------------------------------------------------------
  106.     Procedure: TZoomForm.FormClose
  107.   Description: standard FormClose procedure
  108.        Author: Mat Ballard
  109.  Date created: 04/25/2000
  110. Date modified: 04/25/2000 by Mat Ballard
  111.       Purpose: checks for valid user input
  112.  Known Issues:
  113.  ------------------------------------------------------------------------------}
  114. procedure TZoomForm.FormClose(Sender: TObject; var Action: TCloseAction);
  115. var
  116.   Test, TestMax: Single;
  117. begin
  118. {Check that floating point values are valid:}
  119.   Action := caHide;
  120.   try
  121.     XMinNEdit.SetFocus;
  122.     Test := StrToFloat(XMinNEdit.Text);
  123.     XMaxNEdit.SetFocus;
  124.     TestMax := StrToFloat(XMaxNEdit.Text);
  125.     if (TestMax < Test) then
  126.       ERangeError.CreateFmt('The Min (%g) MUST be less than the Max (%g)',
  127.         [Test, TestMax]);
  128.     YMinNEdit.SetFocus;
  129.     Test := StrToFloat(YMinNEdit.Text);
  130.     YMaxNEdit.SetFocus;
  131.     TestMax := StrToFloat(YMaxNEdit.Text);
  132.     if (TestMax < Test) then
  133.       ERangeError.CreateFmt('The Min (%g) MUST be less than the Max (%g)',
  134.         [Test, TestMax]);
  135. {We do the above and below the squelch the warning messages.}
  136.     Tag := Trunc(Test);
  137.   except
  138. {Prevent closure:}
  139.     Action := caNone;
  140.   end;
  141. end;
  142.  
  143.  
  144. end.
  145.