home *** CD-ROM | disk | FTP | other *** search
/ Delphi Anthology / aDELPHI.iso / Runimage / Delphi50 / Demos / Cpl / Date / main.pas < prev    next >
Pascal/Delphi Source File  |  1999-08-11  |  870b  |  50 lines

  1. unit main;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, 
  7.   CtlPanel;
  8.  
  9. type
  10.   TDTConfig = class(TAppletModule)
  11.     procedure DTConfigActivate(Sender: TObject; Data: Integer);
  12.   private
  13.   { private declarations }
  14.   protected
  15.   { protected declarations }
  16.   public
  17.   { public declarations }
  18.   end;
  19.  
  20. var
  21.   DTConfig: TDTConfig;
  22.  
  23. implementation
  24.  
  25. {$R *.DFM}
  26.  
  27. uses
  28.   ufrmdt;
  29.  
  30. procedure TDTConfig.DTConfigActivate(Sender: TObject; Data: Integer);
  31. var
  32.   SysTime: TSystemTime;
  33.   DateTime: TDateTime;
  34.  
  35. begin
  36.   with TfrmDateTime.Create(Application) do
  37.   begin
  38.     if ShowModal = mrOK then
  39.     begin
  40.       DateTime := Now;
  41.       ReplaceDate(DateTime, Calendar.CalendarDate);
  42.       DateTimeToSystemTime(DateTime, SysTime);
  43.       SetLocalTime(SysTime);
  44.     end;
  45.     Free;
  46.   end;
  47. end;
  48.  
  49. end.
  50.