Project DATECOMP
Project Structure
DATECOMP.DPR
program DateComp;
uses
Forms,
DateF in 'DateF.pas' {DateForm};
{$R *.RES}
begin
Application.CreateForm(TDateForm, DateForm);
Application.Run;
end.
DATEF.PAS
unit DateF;
interface
uses
SysUtils, Windows, Messages, Classes, Graphics, Controls,
Forms, Dialogs, Dates, StdCtrls;
type
TDateForm = class(TForm)
LabelDate: TLabel;
BtnIncrease: TButton;
BtnDecrease: TButton;
BtnAdd10: TButton;
BtnSubtract10: TButton;
EditMonth: TEdit;
EditDay: TEdit;
EditYear: TEdit;
ButtonRead: TButton;
ButtonWrite: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Date1: TDate;
procedure BtnIncreaseClick(Sender: TObject);
procedure BtnDecreaseClick(Sender: TObject);
procedure BtnAdd10Click(Sender: TObject);
procedure BtnSubtract10Click(Sender: TObject);
procedure ButtonReadClick(Sender: TObject);
procedure ButtonWriteClick(Sender: TObject);
procedure Date1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DateForm: TDateForm;
implementation
{$R *.DFM}
procedure TDateForm.BtnIncreaseClick(Sender: TObject);
begin
Date1.Increase;
end;
procedure TDateForm.BtnDecreaseClick(Sender: TObject);
begin
Date1.Decrease;
end;
procedure TDateForm.BtnAdd10Click(Sender: TObject);
begin
Date1.Increase (10);
end;
procedure TDateForm.BtnSubtract10Click(Sender: TObject);
begin
Date1.Decrease (10);
end;
procedure TDateForm.ButtonReadClick(Sender: TObject);
begin
EditYear.Text := IntToStr (Date1.Year);
EditMonth.Text := IntToStr (Date1.Month);
EditDay.Text := IntToStr (Date1.Day);
end;
procedure TDateForm.ButtonWriteClick(Sender: TObject);
begin
Date1.SetValue (StrToInt (EditYear.Text),
StrToInt (EditMonth.Text),
StrToInt (EditDay.Text));
end;
procedure TDateForm.Date1Change(Sender: TObject);
begin
LabelDate.Caption := Date1.Text;
end;
end.
DATEF.DFM
object DateForm: TDateForm
Left = 207
Top = 114
Width = 355
Height = 243
ActiveControl = BtnIncrease
Caption = 'Dates'
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = True
OnCreate = Date1Change
PixelsPerInch = 96
TextHeight = 13
object LabelDate: TLabel
Left = 0
Top = 16
Width = 313
Height = 32
Alignment = taCenter
AutoSize = False
Caption = 'date'
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -27
Font.Name = 'Arial'
Font.Style = [fsBold]
ParentFont = False
end
object Label1: TLabel
Left = 169
Top = 124
Width = 30
Height = 13
Caption = 'Month'
end
object Label2: TLabel
Left = 168
Top = 156
Width = 19
Height = 13
Caption = 'Day'
end
object Label3: TLabel
Left = 169
Top = 188
Width = 22
Height = 13
Caption = 'Year'
end
object BtnIncrease: TButton
Left = 8
Top = 56
Width = 73
Height = 33
Caption = '&Increase'
TabOrder = 0
OnClick = BtnIncreaseClick
end
object BtnDecrease: TButton
Left = 168
Top = 56
Width = 81
Height = 33
Caption = '&Decrease'
TabOrder = 1
OnClick = BtnDecreaseClick
end
object BtnAdd10: TButton
Left = 88
Top = 56
Width = 73
Height = 33
Caption = '&Add 10'
TabOrder = 2
OnClick = BtnAdd10Click
end
object BtnSubtract10: TButton
Left = 256
Top = 56
Width = 81
Height = 33
Caption = '&Subtract 10'
TabOrder = 3
OnClick = BtnSubtract10Click
end
object EditMonth: TEdit
Left = 208
Top = 120
Width = 121
Height = 21
TabOrder = 4
end
object EditDay: TEdit
Left = 208
Top = 152
Width = 121
Height = 21
TabOrder = 5
end
object EditYear: TEdit
Left = 208
Top = 184
Width = 121
Height = 21
TabOrder = 6
end
object ButtonRead: TButton
Left = 40
Top = 128
Width = 75
Height = 25
Caption = '&Read'
TabOrder = 7
OnClick = ButtonReadClick
end
object ButtonWrite: TButton
Left = 40
Top = 168
Width = 75
Height = 25
Caption = '&Write'
TabOrder = 8
OnClick = ButtonWriteClick
end
object Date1: TDate
Day = 16
Month = 10
Year = 1998
OnChange = Date1Change
Left = 16
Top = 8
end
end
|