home *** CD-ROM | disk | FTP | other *** search
/ Exame Informatica 142 / Exame Informatica 142.iso / Programas / Cerberus / CerberusSetup.exe / CerberusNET_Source / preferences.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2006-01-29  |  2.1 KB  |  103 lines

  1. {
  2.  (C) Paul Alan Freshney 2006
  3.  (Based on an Indy Client Demo)
  4.  
  5.   Last Modified: January 29th 2006
  6.  
  7.   This code is free to use as you wish. Please do not distribute this code without
  8.   authorisation from myself. We are free to distribute versions of CerberusNET as
  9.   you wish as long as you link to "www.paulalanfreshney.com/cerberus" somewhere
  10.   within the application!
  11.  
  12.   102
  13. }
  14.  
  15. unit preferences;
  16.  
  17. interface
  18.  
  19. uses
  20.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  21.   Dialogs, Buttons, ExtCtrls, StdCtrls, ComCtrls;
  22.  
  23. type
  24.   TfrmPreferences = class(TForm)
  25.     BitBtn1: TBitBtn;
  26.     BitBtn2: TBitBtn;
  27.     Bevel1: TBevel;
  28.     SpeedButton1: TSpeedButton;
  29.     pHello: TPanel;
  30.     Label1: TLabel;
  31.     pConnection: TPanel;
  32.     Label2: TLabel;
  33.     eCHost: TEdit;
  34.     Label3: TLabel;
  35.     eCPort: TEdit;
  36.     Label4: TLabel;
  37.     tbCRefresh: TTrackBar;
  38.     lCRefresh: TLabel;
  39.     procedure FormShow(Sender: TObject);
  40.     procedure SpeedButton1Click(Sender: TObject);
  41.     procedure tbCRefreshChange(Sender: TObject);
  42.   private
  43.     { Private declarations }
  44.   public
  45.     { Public declarations }
  46.   end;
  47.  
  48. var
  49.   frmPreferences: TfrmPreferences;
  50.  
  51. function DoPreferences: word;
  52.  
  53. implementation
  54.  
  55. {$R *.dfm}
  56.  
  57. uses utility;
  58.  
  59. function DoPreferences: word;
  60.  var
  61.   ret : word;
  62.  
  63.  begin
  64.   with TfrmPreferences.Create(Application) do begin
  65.     ShowModal;
  66.  
  67.     ret:=ModalResult;
  68.  
  69.     if ModalResult=mrOK then begin
  70.       with CNETPreferenes do begin
  71.         CHost :=eCHost.Text;
  72.         CPort :=StrToInt(eCPort.Text);
  73.         CRefresh :=tbCRefresh.Position;
  74.       end;
  75.     end;
  76.   end;
  77.  
  78.   Result:=ret;
  79. end;
  80.  
  81. procedure TfrmPreferences.FormShow(Sender: TObject);
  82.  begin
  83.   pHello.BringToFront;
  84.  
  85.   with CNETPreferenes do begin
  86.     eCHost.Text :=CHost;
  87.     eCPort.Text :=IntToStr(CPort);
  88.     tbCRefresh.Position :=CRefresh;
  89.   end;
  90. end;
  91.  
  92. procedure TfrmPreferences.SpeedButton1Click(Sender: TObject);
  93.  begin
  94.   pConnection.BringToFront;
  95. end;
  96.  
  97. procedure TfrmPreferences.tbCRefreshChange(Sender: TObject);
  98.  begin
  99.   lCRefresh.Caption:='('+IntToStr(tbCRefresh.Position)+' seconds)';
  100. end;
  101.  
  102. end.
  103.