home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 October / Chip_2001-10_cd1.bin / zkuste / delphi / kompon / d123456 / CHEMPLOT.ZIP / Misc / Aboutdlg.pas < prev    next >
Pascal/Delphi Source File  |  2001-05-02  |  4KB  |  143 lines

  1. unit Aboutdlg;
  2.  
  3. {$I Misc.inc}
  4.  
  5. {-----------------------------------------------------------------------------
  6. The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
  7.  
  8. http://www.mozilla.org/MPL/MPL-1.1.html
  9.  
  10. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for the specific language governing rights and limitations under the License.
  11.  
  12. The Original Code is: AboutDlg.pas, released 12 September 2000.
  13.  
  14. The Initial Developer of the Original Code is Mat Ballard.
  15. Portions created by Mat Ballard are Copyright (C) 1999 Mat Ballard.
  16. Portions created by Microsoft are Copyright (C) 1998, 1999 Microsoft Corp.
  17. All Rights Reserved.
  18.  
  19. Contributor(s): Mat Ballard                 e-mail: mat.ballard@chemware.hypermart.net.
  20.  
  21. Last Modified: 05/25/2000
  22. Current Version: 2.00
  23.  
  24. You may retrieve the latest version of this file from:
  25.  
  26.         http://Chemware.hypermart.net/
  27.  
  28. This work was created with the Project JEDI VCL guidelines:
  29.  
  30.         http://www.delphi-jedi.org/Jedi:VCLVCL
  31.  
  32. in mind. 
  33.  
  34.  
  35. Purpose:
  36. This file contains a component wrapper for the AboutBox form.
  37. A component wrapper presents a form as a Delphi Component, which can be added
  38. to the component palette.
  39.  
  40. Known Issues:
  41. -----------------------------------------------------------------------------}
  42.  
  43. interface
  44.  
  45. uses
  46.   Classes, SysUtils,
  47. {$IFDEF WINDOWS}
  48.   WinTypes, WinProcs,
  49.   Controls, Forms,
  50. {$ENDIF}
  51. {$IFDEF WIN32}
  52.   Windows,
  53.   Controls, Forms,
  54. {$ENDIF}
  55. {$IFDEF LINUX}
  56.   QControls, QForms,
  57. {$ENDIF}
  58.   About;
  59.  
  60. const
  61.   TABOUTDLG_VERSION = 200;
  62.  
  63. type
  64.   TAboutDlg = class(TComponent)
  65.   private
  66.     FComments: String;
  67.     FURL: String;
  68.     FEmail: String;
  69. {procedures:}
  70.  
  71.   public
  72.     constructor Create(AOwner: TComponent); override;
  73.     {This is the normal constructor. It initializes properties.}
  74.     function Execute: Boolean; virtual;
  75.     {This function creates and runs the AboutBox. It is similar to the Execute
  76.      function of the common dialog boxes.}
  77.     {}
  78.     {Its purpose is to display the AboutBox.}
  79.  
  80.   published
  81.     property Comments: String read FComments write FComments;
  82.     {This is to display a message about the registration state of you product,
  83.      but could really be used for anything.}
  84.     property Email: String read FEmail write FEmail;
  85.     {This is your email address.}
  86.     property URL: String read FURL write FURL;
  87.     {This is the URL of your website. Clicking on it will start your web browser
  88.      and load that URL.}
  89.   end;
  90.  
  91. var
  92.   AboutBox: TAboutBox;
  93.  
  94. implementation
  95.  
  96. {------------------------------------------------------------------------------
  97.     Procedure: TAboutDlg.Create
  98.   Description: standard constructor
  99.        Author: Mat Ballard
  100.  Date created: 04/25/2000
  101. Date modified: 04/25/2000 by Mat Ballard
  102.       Purpose: sets default properties
  103.  Known Issues:
  104.  ------------------------------------------------------------------------------}
  105. constructor TAboutDlg.Create(AOwner: TComponent);
  106. begin
  107.   inherited Create(AOwner);
  108.   FEmail := 'Mat.Ballard@Chemware.hypermart.net';
  109.   FURL := 'http://chemware.hypermart.net/';
  110. end;
  111.  
  112. {------------------------------------------------------------------------------
  113.      Function: TAboutDlg.Execute
  114.   Description: Runs the About dialog box
  115.        Author: Mat Ballard
  116.  Date created: 04/25/2000
  117. Date modified: 04/25/2000 by Mat Ballard
  118.       Purpose: see Description
  119.  Return Value: TRUE if user selects "OK"
  120.  Known Issues:
  121.  ------------------------------------------------------------------------------}
  122. function TAboutDlg.Execute: Boolean;
  123. begin
  124.   AboutBox := TAboutBox.Create(Application);
  125.   with AboutBox do
  126.   begin
  127.     if (Length(FComments) > 0) then
  128.       CommentsLabel.Caption := FComments;
  129.     EmailLabel.Caption := FEmail;
  130.     URLLabel.Caption := FURL;
  131.     DoGeometry;
  132.   end;
  133.  
  134.   try
  135.     Result := (AboutBox.ShowModal = mrOk); {1}
  136.   finally
  137.     AboutBox.Free;
  138.   end;
  139. end;
  140.  
  141.  
  142. end.
  143.