mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 23:19:12 +02:00
added easter example
git-svn-id: trunk@4506 -
This commit is contained in:
parent
ffa38d9925
commit
a75902dbfa
8
.gitattributes
vendored
8
.gitattributes
vendored
@ -265,6 +265,14 @@ examples/checkbox.pp svneol=native#text/pascal
|
|||||||
examples/combobox.pp svneol=native#text/pascal
|
examples/combobox.pp svneol=native#text/pascal
|
||||||
examples/comdialogs.pp svneol=native#text/pascal
|
examples/comdialogs.pp svneol=native#text/pascal
|
||||||
examples/dlgform.pp svneol=native#text/pascal
|
examples/dlgform.pp svneol=native#text/pascal
|
||||||
|
examples/easter/about.lfm svneol=native#text/plain
|
||||||
|
examples/easter/about.lrs svneol=native#text/pascal
|
||||||
|
examples/easter/about.pas svneol=native#text/pascal
|
||||||
|
examples/easter/holyday.lpi svneol=native#text/plain
|
||||||
|
examples/easter/holyday.lpr svneol=native#text/pascal
|
||||||
|
examples/easter/main.lfm svneol=native#text/plain
|
||||||
|
examples/easter/main.lrs svneol=native#text/pascal
|
||||||
|
examples/easter/main.pas svneol=native#text/pascal
|
||||||
examples/edittest.pp svneol=native#text/pascal
|
examples/edittest.pp svneol=native#text/pascal
|
||||||
examples/groupbox.pp svneol=native#text/pascal
|
examples/groupbox.pp svneol=native#text/pascal
|
||||||
examples/groupboxnested.pas svneol=native#text/pascal
|
examples/groupboxnested.pas svneol=native#text/pascal
|
||||||
|
64
examples/easter/about.lfm
Normal file
64
examples/easter/about.lfm
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
object AboutBox: TAboutBox
|
||||||
|
ACTIVECONTROL = CloseButton
|
||||||
|
BORDERSTYLE = bsdialog
|
||||||
|
CAPTION = 'Info zu "Holy Days"'
|
||||||
|
CLIENTHEIGHT = 176
|
||||||
|
CLIENTWIDTH = 439
|
||||||
|
POSITION = pomainformcenter
|
||||||
|
HORZSCROLLBAR.PAGE = 440
|
||||||
|
VERTSCROLLBAR.PAGE = 177
|
||||||
|
LEFT = 341
|
||||||
|
HEIGHT = 176
|
||||||
|
TOP = 290
|
||||||
|
WIDTH = 439
|
||||||
|
object Label1: TLABEL
|
||||||
|
CAPTION = 'Osterberechung, umgesetztes Beispiel von Delphi nach Lazarus'
|
||||||
|
LAYOUT = tltop
|
||||||
|
LEFT = 16
|
||||||
|
HEIGHT = 17
|
||||||
|
TOP = 32
|
||||||
|
WIDTH = 408
|
||||||
|
end
|
||||||
|
object Label2: TLABEL
|
||||||
|
CAPTION = 'Copyright (C) 2003 Michael Starke und Toolbox, Ausgabe 5/2003'
|
||||||
|
LAYOUT = tltop
|
||||||
|
LEFT = 16
|
||||||
|
HEIGHT = 17
|
||||||
|
TOP = 48
|
||||||
|
WIDTH = 409
|
||||||
|
end
|
||||||
|
object Warn2Label: TLABEL
|
||||||
|
CAPTION = 'Diese Version funktioniert nur von 1900 bis 2099.'
|
||||||
|
LAYOUT = tltop
|
||||||
|
LEFT = 16
|
||||||
|
HEIGHT = 17
|
||||||
|
TOP = 104
|
||||||
|
WIDTH = 369
|
||||||
|
end
|
||||||
|
object CloseButton: TBUTTON
|
||||||
|
CAPTION = 'Exit'
|
||||||
|
TABSTOP = True
|
||||||
|
TABORDER = 3
|
||||||
|
ONCLICK = Button1CLICK
|
||||||
|
LEFT = 320
|
||||||
|
HEIGHT = 25
|
||||||
|
TOP = 144
|
||||||
|
WIDTH = 75
|
||||||
|
end
|
||||||
|
object Warn1Label: TLABEL
|
||||||
|
CAPTION = 'Achtung:'
|
||||||
|
LAYOUT = tltop
|
||||||
|
LEFT = 16
|
||||||
|
HEIGHT = 17
|
||||||
|
TOP = 72
|
||||||
|
WIDTH = 65
|
||||||
|
end
|
||||||
|
object Warn3Label: TLABEL
|
||||||
|
CAPTION = 'Es findet keine Fehlerueberpruefung statt!'
|
||||||
|
LAYOUT = tltop
|
||||||
|
LEFT = 16
|
||||||
|
HEIGHT = 17
|
||||||
|
TOP = 120
|
||||||
|
WIDTH = 376
|
||||||
|
end
|
||||||
|
end
|
22
examples/easter/about.lrs
Normal file
22
examples/easter/about.lrs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{ Dies ist eine automatisch erzeugtes resource Datei }
|
||||||
|
|
||||||
|
LazarusResources.Add('TAboutBox','FORMDATA',[
|
||||||
|
'TPF0'#9'TAboutBox'#8'AboutBox'#13'ACTIVECONTROL'#7#11'CloseButton'#11'BORDER'
|
||||||
|
+'STYLE'#7#8'bsdialog'#7'CAPTION'#6#19'Info zu "Holy Days"'#12'CLIENTHEIGHT'#3
|
||||||
|
+#176#0#11'CLIENTWIDTH'#3#183#1#8'POSITION'#7#16'pomainformcenter'#18'HORZSCR'
|
||||||
|
+'OLLBAR.PAGE'#3#184#1#18'VERTSCROLLBAR.PAGE'#3#177#0#4'LEFT'#3'U'#1#6'HEIGHT'
|
||||||
|
+#3#176#0#3'TOP'#3'"'#1#5'WIDTH'#3#183#1#0#6'TLABEL'#6'Label1'#7'CAPTION'#6'<'
|
||||||
|
+'Osterberechung, umgesetztes Beispiel von Delphi nach Lazarus'#6'LAYOUT'#7#5
|
||||||
|
+'tltop'#4'LEFT'#2#16#6'HEIGHT'#2#17#3'TOP'#2' '#5'WIDTH'#3#152#1#0#0#6'TLABE'
|
||||||
|
+'L'#6'Label2'#7'CAPTION'#6'=Copyright (C) 2003 Michael Starke und Toolbox, A'
|
||||||
|
+'usgabe 5/2003'#6'LAYOUT'#7#5'tltop'#4'LEFT'#2#16#6'HEIGHT'#2#17#3'TOP'#2'0'
|
||||||
|
+#5'WIDTH'#3#153#1#0#0#6'TLABEL'#10'Warn2Label'#7'CAPTION'#6'1Diese Version f'
|
||||||
|
+'unktioniert nur von 1900 bis 2099.'#6'LAYOUT'#7#5'tltop'#4'LEFT'#2#16#6'HEI'
|
||||||
|
+'GHT'#2#17#3'TOP'#2'h'#5'WIDTH'#3'q'#1#0#0#7'TBUTTON'#11'CloseButton'#7'CAPT'
|
||||||
|
+'ION'#6#4'Exit'#7'TABSTOP'#9#8'TABORDER'#2#3#7'ONCLICK'#7#12'Button1CLICK'#4
|
||||||
|
+'LEFT'#3'@'#1#6'HEIGHT'#2#25#3'TOP'#3#144#0#5'WIDTH'#2'K'#0#0#6'TLABEL'#10'W'
|
||||||
|
+'arn1Label'#7'CAPTION'#6#8'Achtung:'#6'LAYOUT'#7#5'tltop'#4'LEFT'#2#16#6'HEI'
|
||||||
|
+'GHT'#2#17#3'TOP'#2'H'#5'WIDTH'#2'A'#0#0#6'TLABEL'#10'Warn3Label'#7'CAPTION'
|
||||||
|
+#6'*Es findet keine Fehlerueberpruefung statt!'#6'LAYOUT'#7#5'tltop'#4'LEFT'
|
||||||
|
+#2#16#6'HEIGHT'#2#17#3'TOP'#2'x'#5'WIDTH'#3'x'#1#0#0#0
|
||||||
|
]);
|
38
examples/easter/about.pas
Normal file
38
examples/easter/about.pas
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
UNIT about;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
INTERFACE
|
||||||
|
|
||||||
|
USES
|
||||||
|
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||||
|
Buttons;
|
||||||
|
|
||||||
|
TYPE
|
||||||
|
TAboutBox = CLASS(TForm)
|
||||||
|
CloseButton: TBUTTON;
|
||||||
|
Label1: TLABEL;
|
||||||
|
Label2: TLABEL;
|
||||||
|
Warn2Label: TLABEL;
|
||||||
|
Warn1Label: TLABEL;
|
||||||
|
Warn3Label: TLABEL;
|
||||||
|
PROCEDURE Button1CLICK(Sender: TObject);
|
||||||
|
END;
|
||||||
|
|
||||||
|
VAR
|
||||||
|
AboutBox: TAboutBox;
|
||||||
|
|
||||||
|
IMPLEMENTATION
|
||||||
|
|
||||||
|
{ TAboutBox }
|
||||||
|
|
||||||
|
PROCEDURE TAboutBox.Button1CLICK(Sender: TObject);
|
||||||
|
BEGIN
|
||||||
|
Close;
|
||||||
|
END;
|
||||||
|
|
||||||
|
INITIALIZATION
|
||||||
|
{$I about.lrs}
|
||||||
|
|
||||||
|
END.
|
||||||
|
|
80
examples/easter/holyday.lpi
Normal file
80
examples/easter/holyday.lpi
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
<General>
|
||||||
|
<ProjectType Value="Application"/>
|
||||||
|
<Flags>
|
||||||
|
<SaveClosedFiles Value="False"/>
|
||||||
|
<SaveOnlyProjectUnits Value="True"/>
|
||||||
|
</Flags>
|
||||||
|
<MainUnit Value="0"/>
|
||||||
|
<ActiveEditorIndexAtStart Value="1"/>
|
||||||
|
<IconPath Value="./"/>
|
||||||
|
<TargetFileExt Value=""/>
|
||||||
|
<Title Value="holyday"/>
|
||||||
|
</General>
|
||||||
|
<Units Count="3">
|
||||||
|
<Unit0>
|
||||||
|
<CursorPos X="4" Y="14"/>
|
||||||
|
<EditorIndex Value="2"/>
|
||||||
|
<Filename Value="holyday.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
<TopLine Value="1"/>
|
||||||
|
<UnitName Value="holyday"/>
|
||||||
|
<UsageCount Value="23"/>
|
||||||
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<CursorPos X="14" Y="103"/>
|
||||||
|
<EditorIndex Value="0"/>
|
||||||
|
<Filename Value="main.pas"/>
|
||||||
|
<ComponentName Value="Form1"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
<ResourceFilename Value="main.lrs"/>
|
||||||
|
<TopLine Value="83"/>
|
||||||
|
<UnitName Value="Main"/>
|
||||||
|
<UsageCount Value="23"/>
|
||||||
|
</Unit1>
|
||||||
|
<Unit2>
|
||||||
|
<CursorPos X="23" Y="26"/>
|
||||||
|
<EditorIndex Value="1"/>
|
||||||
|
<Filename Value="about.pas"/>
|
||||||
|
<ComponentName Value="AboutBox"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
<ResourceFilename Value="about.lrs"/>
|
||||||
|
<TopLine Value="1"/>
|
||||||
|
<UnitName Value="about"/>
|
||||||
|
<UsageCount Value="23"/>
|
||||||
|
</Unit2>
|
||||||
|
</Units>
|
||||||
|
<PublishOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
<IgnoreBinaries Value="False"/>
|
||||||
|
</PublishOptions>
|
||||||
|
<RunParams>
|
||||||
|
<local>
|
||||||
|
<FormatVersion Value="1"/>
|
||||||
|
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||||
|
</local>
|
||||||
|
</RunParams>
|
||||||
|
<RequiredPackages Count="1">
|
||||||
|
<Item1>
|
||||||
|
<PackageName Value="LCL"/>
|
||||||
|
<MinVersion Major="1" Valid="True"/>
|
||||||
|
</Item1>
|
||||||
|
</RequiredPackages>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<SearchPaths>
|
||||||
|
<OtherUnitFiles Value="$(LazarusDir)/lcl/units/;$(LazarusDir)/lcl/units/$(LCLWidgetType)/"/>
|
||||||
|
<LCLWidgetType Value="gtk"/>
|
||||||
|
<SrcPath Value="$(LazarusDir)/lcl/;$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)/"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Other>
|
||||||
|
<CompilerPath Value="$(CompPath)"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
</CONFIG>
|
15
examples/easter/holyday.lpr
Normal file
15
examples/easter/holyday.lpr
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
PROGRAM holyday;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
USES
|
||||||
|
Interfaces,
|
||||||
|
Forms, Main, about;
|
||||||
|
|
||||||
|
BEGIN
|
||||||
|
Application.Initialize;
|
||||||
|
Application.CreateForm(TForm1, Form1);
|
||||||
|
Application.CreateForm(TAboutBox, AboutBox);
|
||||||
|
Application.Run;
|
||||||
|
END.
|
||||||
|
|
142
examples/easter/main.lfm
Normal file
142
examples/easter/main.lfm
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
object Form1: TForm1
|
||||||
|
BORDERSTYLE = bsdialog
|
||||||
|
CAPTION = 'Holy Days'
|
||||||
|
CLIENTHEIGHT = 195
|
||||||
|
CLIENTWIDTH = 430
|
||||||
|
ONCREATE = Form1CREATE
|
||||||
|
ONSHOW = Form1SHOW
|
||||||
|
POSITION = podesktopcenter
|
||||||
|
HORZSCROLLBAR.PAGE = 431
|
||||||
|
VERTSCROLLBAR.PAGE = 196
|
||||||
|
LEFT = 392
|
||||||
|
HEIGHT = 195
|
||||||
|
TOP = 213
|
||||||
|
WIDTH = 430
|
||||||
|
object Bevel1: TBEVEL
|
||||||
|
HEIGHT = 165
|
||||||
|
LEFT = 13
|
||||||
|
NAME = 'Bevel1'
|
||||||
|
SHAPE = bsframe
|
||||||
|
TOP = 11
|
||||||
|
WIDTH = 282
|
||||||
|
LEFT = 13
|
||||||
|
HEIGHT = 165
|
||||||
|
TOP = 11
|
||||||
|
WIDTH = 282
|
||||||
|
end
|
||||||
|
object CalculateButton: TBUTTON
|
||||||
|
CAPTION = 'Berechne'
|
||||||
|
TABSTOP = True
|
||||||
|
TABORDER = 0
|
||||||
|
ONCLICK = Button1CLICK
|
||||||
|
LEFT = 312
|
||||||
|
HEIGHT = 35
|
||||||
|
TOP = 56
|
||||||
|
WIDTH = 104
|
||||||
|
end
|
||||||
|
object Listbox1: TLISTBOX
|
||||||
|
STYLE = lbownerdrawvariable
|
||||||
|
TABORDER = 1
|
||||||
|
TABSTOP = True
|
||||||
|
TOPINDEX = -1
|
||||||
|
LEFT = 136
|
||||||
|
HEIGHT = 101
|
||||||
|
TOP = 64
|
||||||
|
WIDTH = 141
|
||||||
|
end
|
||||||
|
object Edit1: TEDIT
|
||||||
|
TEXT = '2003'
|
||||||
|
TABSTOP = True
|
||||||
|
TABORDER = 2
|
||||||
|
LEFT = 136
|
||||||
|
HEIGHT = 23
|
||||||
|
TOP = 24
|
||||||
|
WIDTH = 141
|
||||||
|
end
|
||||||
|
object AshWednesdayLabel: TLABEL
|
||||||
|
CAPTION = 'Aschermittwoch:'
|
||||||
|
LAYOUT = tltop
|
||||||
|
LEFT = 24
|
||||||
|
HEIGHT = 17
|
||||||
|
TOP = 64
|
||||||
|
WIDTH = 104
|
||||||
|
end
|
||||||
|
object YearLabel: TLABEL
|
||||||
|
CAPTION = 'Jahr'
|
||||||
|
LAYOUT = tltop
|
||||||
|
LEFT = 24
|
||||||
|
HEIGHT = 17
|
||||||
|
TOP = 24
|
||||||
|
WIDTH = 104
|
||||||
|
end
|
||||||
|
object GoodFridayLabel: TLABEL
|
||||||
|
CAPTION = 'Karfreitag:'
|
||||||
|
LAYOUT = tltop
|
||||||
|
LEFT = 24
|
||||||
|
HEIGHT = 17
|
||||||
|
TOP = 81
|
||||||
|
WIDTH = 104
|
||||||
|
end
|
||||||
|
object EasterMondayLabel: TLABEL
|
||||||
|
CAPTION = 'Ostermontag'
|
||||||
|
LAYOUT = tltop
|
||||||
|
LEFT = 24
|
||||||
|
HEIGHT = 17
|
||||||
|
TOP = 98
|
||||||
|
WIDTH = 104
|
||||||
|
end
|
||||||
|
object AscensionDayLabel: TLABEL
|
||||||
|
CAPTION = 'Himmelfahrt'
|
||||||
|
LAYOUT = tltop
|
||||||
|
LEFT = 24
|
||||||
|
HEIGHT = 17
|
||||||
|
TOP = 115
|
||||||
|
WIDTH = 104
|
||||||
|
end
|
||||||
|
object PentecostLabel: TLABEL
|
||||||
|
CAPTION = 'Pfingsten'
|
||||||
|
LAYOUT = tltop
|
||||||
|
LEFT = 24
|
||||||
|
HEIGHT = 17
|
||||||
|
TOP = 131
|
||||||
|
WIDTH = 104
|
||||||
|
end
|
||||||
|
object CorpusCristiLabel: TLABEL
|
||||||
|
CAPTION = 'Fronleichnam'
|
||||||
|
LAYOUT = tltop
|
||||||
|
LEFT = 24
|
||||||
|
HEIGHT = 17
|
||||||
|
TOP = 149
|
||||||
|
WIDTH = 104
|
||||||
|
end
|
||||||
|
object EndButton: TBUTTON
|
||||||
|
CAPTION = 'Ende'
|
||||||
|
TABSTOP = True
|
||||||
|
TABORDER = 10
|
||||||
|
ONCLICK = Button2CLICK
|
||||||
|
LEFT = 312
|
||||||
|
HEIGHT = 35
|
||||||
|
TOP = 104
|
||||||
|
WIDTH = 104
|
||||||
|
end
|
||||||
|
object AboutButton: TBUTTON
|
||||||
|
CAPTION = 'Info'
|
||||||
|
TABSTOP = True
|
||||||
|
TABORDER = 11
|
||||||
|
ONCLICK = Button3CLICK
|
||||||
|
LEFT = 312
|
||||||
|
HEIGHT = 35
|
||||||
|
TOP = 152
|
||||||
|
WIDTH = 104
|
||||||
|
end
|
||||||
|
object LanguageButton: TBUTTON
|
||||||
|
CAPTION = 'English'
|
||||||
|
TABSTOP = True
|
||||||
|
TABORDER = 12
|
||||||
|
ONCLICK = LanguageButtonCLICK
|
||||||
|
LEFT = 312
|
||||||
|
HEIGHT = 35
|
||||||
|
TOP = 8
|
||||||
|
WIDTH = 104
|
||||||
|
end
|
||||||
|
end
|
37
examples/easter/main.lrs
Normal file
37
examples/easter/main.lrs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
{ Dies ist eine automatisch erzeugtes resource Datei }
|
||||||
|
|
||||||
|
LazarusResources.Add('TForm1','FORMDATA',[
|
||||||
|
'TPF0'#6'TForm1'#5'Form1'#11'BORDERSTYLE'#7#8'bsdialog'#7'CAPTION'#6#9'Holy D'
|
||||||
|
+'ays'#12'CLIENTHEIGHT'#3#195#0#11'CLIENTWIDTH'#3#174#1#8'ONCREATE'#7#11'Form'
|
||||||
|
+'1CREATE'#6'ONSHOW'#7#9'Form1SHOW'#8'POSITION'#7#15'podesktopcenter'#18'HORZ'
|
||||||
|
+'SCROLLBAR.PAGE'#3#175#1#18'VERTSCROLLBAR.PAGE'#3#196#0#4'LEFT'#3#136#1#6'HE'
|
||||||
|
+'IGHT'#3#195#0#3'TOP'#3#213#0#5'WIDTH'#3#174#1#0#6'TBEVEL'#6'Bevel1'#6'HEIGH'
|
||||||
|
+'T'#3#165#0#4'LEFT'#2#13#4'NAME'#6#6'Bevel1'#5'SHAPE'#7#7'bsframe'#3'TOP'#2
|
||||||
|
+#11#5'WIDTH'#3#26#1#4'LEFT'#2#13#6'HEIGHT'#3#165#0#3'TOP'#2#11#5'WIDTH'#3#26
|
||||||
|
+#1#0#0#7'TBUTTON'#15'CalculateButton'#7'CAPTION'#6#8'Berechne'#7'TABSTOP'#9#8
|
||||||
|
+'TABORDER'#2#0#7'ONCLICK'#7#12'Button1CLICK'#4'LEFT'#3'8'#1#6'HEIGHT'#2'#'#3
|
||||||
|
+'TOP'#2'8'#5'WIDTH'#2'h'#0#0#8'TLISTBOX'#8'Listbox1'#5'STYLE'#7#19'lbownerdr'
|
||||||
|
+'awvariable'#8'TABORDER'#2#1#7'TABSTOP'#9#8'TOPINDEX'#2#255#4'LEFT'#3#136#0#6
|
||||||
|
+'HEIGHT'#2'e'#3'TOP'#2'@'#5'WIDTH'#3#141#0#0#0#5'TEDIT'#5'Edit1'#4'TEXT'#6#4
|
||||||
|
+'2003'#7'TABSTOP'#9#8'TABORDER'#2#2#4'LEFT'#3#136#0#6'HEIGHT'#2#23#3'TOP'#2
|
||||||
|
+#24#5'WIDTH'#3#141#0#0#0#6'TLABEL'#17'AshWednesdayLabel'#7'CAPTION'#6#15'Asc'
|
||||||
|
+'hermittwoch:'#6'LAYOUT'#7#5'tltop'#4'LEFT'#2#24#6'HEIGHT'#2#17#3'TOP'#2'@'#5
|
||||||
|
+'WIDTH'#2'h'#0#0#6'TLABEL'#9'YearLabel'#7'CAPTION'#6#4'Jahr'#6'LAYOUT'#7#5't'
|
||||||
|
+'ltop'#4'LEFT'#2#24#6'HEIGHT'#2#17#3'TOP'#2#24#5'WIDTH'#2'h'#0#0#6'TLABEL'#15
|
||||||
|
+'GoodFridayLabel'#7'CAPTION'#6#11'Karfreitag:'#6'LAYOUT'#7#5'tltop'#4'LEFT'#2
|
||||||
|
+#24#6'HEIGHT'#2#17#3'TOP'#2'Q'#5'WIDTH'#2'h'#0#0#6'TLABEL'#17'EasterMondayLa'
|
||||||
|
+'bel'#7'CAPTION'#6#11'Ostermontag'#6'LAYOUT'#7#5'tltop'#4'LEFT'#2#24#6'HEIGH'
|
||||||
|
+'T'#2#17#3'TOP'#2'b'#5'WIDTH'#2'h'#0#0#6'TLABEL'#17'AscensionDayLabel'#7'CAP'
|
||||||
|
+'TION'#6#11'Himmelfahrt'#6'LAYOUT'#7#5'tltop'#4'LEFT'#2#24#6'HEIGHT'#2#17#3
|
||||||
|
+'TOP'#2's'#5'WIDTH'#2'h'#0#0#6'TLABEL'#14'PentecostLabel'#7'CAPTION'#6#9'Pfi'
|
||||||
|
+'ngsten'#6'LAYOUT'#7#5'tltop'#4'LEFT'#2#24#6'HEIGHT'#2#17#3'TOP'#3#131#0#5'W'
|
||||||
|
+'IDTH'#2'h'#0#0#6'TLABEL'#17'CorpusCristiLabel'#7'CAPTION'#6#12'Fronleichnam'
|
||||||
|
+#6'LAYOUT'#7#5'tltop'#4'LEFT'#2#24#6'HEIGHT'#2#17#3'TOP'#3#149#0#5'WIDTH'#2
|
||||||
|
+'h'#0#0#7'TBUTTON'#9'EndButton'#7'CAPTION'#6#4'Ende'#7'TABSTOP'#9#8'TABORDER'
|
||||||
|
+#2#10#7'ONCLICK'#7#12'Button2CLICK'#4'LEFT'#3'8'#1#6'HEIGHT'#2'#'#3'TOP'#2'h'
|
||||||
|
+#5'WIDTH'#2'h'#0#0#7'TBUTTON'#11'AboutButton'#7'CAPTION'#6#4'Info'#7'TABSTOP'
|
||||||
|
+#9#8'TABORDER'#2#11#7'ONCLICK'#7#12'Button3CLICK'#4'LEFT'#3'8'#1#6'HEIGHT'#2
|
||||||
|
+'#'#3'TOP'#3#152#0#5'WIDTH'#2'h'#0#0#7'TBUTTON'#14'LanguageButton'#7'CAPTION'
|
||||||
|
+#6#7'English'#7'TABSTOP'#9#8'TABORDER'#2#12#7'ONCLICK'#7#19'LanguageButtonCL'
|
||||||
|
+'ICK'#4'LEFT'#3'8'#1#6'HEIGHT'#2'#'#3'TOP'#2#8#5'WIDTH'#2'h'#0#0#0
|
||||||
|
]);
|
143
examples/easter/main.pas
Normal file
143
examples/easter/main.pas
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
UNIT Main;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
INTERFACE
|
||||||
|
|
||||||
|
USES
|
||||||
|
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Buttons,
|
||||||
|
About, StdCtrls, ExtCtrls;
|
||||||
|
|
||||||
|
TYPE
|
||||||
|
TForm1 = CLASS(TForm)
|
||||||
|
Bevel1: TBEVEL;
|
||||||
|
LanguageButton: TBUTTON;
|
||||||
|
EndButton: TBUTTON;
|
||||||
|
AboutButton: TBUTTON;
|
||||||
|
CalculateButton: TBUTTON;
|
||||||
|
Edit1: TEDIT;
|
||||||
|
AshWednesdayLabel: TLABEL;
|
||||||
|
YearLabel: TLABEL;
|
||||||
|
GoodFridayLabel: TLABEL;
|
||||||
|
EasterMondayLabel: TLABEL;
|
||||||
|
AscensionDayLabel: TLABEL;
|
||||||
|
PentecostLabel: TLABEL;
|
||||||
|
CorpusCristiLabel: TLABEL;
|
||||||
|
Listbox1: TLISTBOX;
|
||||||
|
PROCEDURE Button1CLICK(Sender: TObject);
|
||||||
|
PROCEDURE Button2CLICK(Sender: TObject);
|
||||||
|
PROCEDURE Button3CLICK(Sender: TObject);
|
||||||
|
procedure Form1CREATE(Sender: TObject);
|
||||||
|
PROCEDURE Form1SHOW(Sender: TObject);
|
||||||
|
procedure LanguageButtonCLICK(Sender: TObject);
|
||||||
|
PUBLIC
|
||||||
|
FUNCTION CalcEasterday(aYear: Word): TDateTime;
|
||||||
|
END;
|
||||||
|
|
||||||
|
VAR
|
||||||
|
Form1: TForm1;
|
||||||
|
|
||||||
|
IMPLEMENTATION
|
||||||
|
|
||||||
|
PROCEDURE TForm1.Button1CLICK(Sender: TObject);
|
||||||
|
VAR
|
||||||
|
Easter: TDateTime;
|
||||||
|
aYear : WORD;
|
||||||
|
BEGIN
|
||||||
|
ListBox1.Clear;
|
||||||
|
TRY
|
||||||
|
aYear := StrToInt(Edit1.Text);
|
||||||
|
EXCEPT
|
||||||
|
ShowMessage('Fehlerhafte Eingabe des Jahrs!');
|
||||||
|
Exit;
|
||||||
|
END;
|
||||||
|
Easter := CalcEasterday(aYear);
|
||||||
|
ListBox1.Items.Add(DateToStr(Easter - 46));
|
||||||
|
ListBox1.Items.Add(DateToStr(Easter - 2));
|
||||||
|
ListBox1.Items.Add(DateToStr(Easter + 1));
|
||||||
|
ListBox1.Items.Add(DateToStr(Easter + 39));
|
||||||
|
ListBox1.Items.Add(DateToStr(Easter + 50));
|
||||||
|
ListBox1.Items.Add(DateToStr(Easter + 60));
|
||||||
|
END;
|
||||||
|
|
||||||
|
PROCEDURE TForm1.Button2CLICK(Sender: TObject);
|
||||||
|
BEGIN
|
||||||
|
Close;
|
||||||
|
END;
|
||||||
|
|
||||||
|
procedure TForm1.Button3CLICK(Sender: TObject);
|
||||||
|
begin
|
||||||
|
AboutBox.ShowModal;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.Form1CREATE(Sender: TObject);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
PROCEDURE TForm1.Form1SHOW(Sender: TObject);
|
||||||
|
BEGIN
|
||||||
|
Button1CLICK(Sender);
|
||||||
|
END;
|
||||||
|
|
||||||
|
procedure TForm1.LanguageButtonCLICK(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if LanguageButton.Caption='English' then begin
|
||||||
|
LanguageButton.Caption:='Deutsch';
|
||||||
|
EndButton.Caption:='Exit';
|
||||||
|
AboutButton.Caption:='About';
|
||||||
|
CalculateButton.Caption:='Calculate';
|
||||||
|
AshWednesdayLabel.Caption:='Ash Wednesday';
|
||||||
|
YearLabel.Caption:='Year';
|
||||||
|
GoodFridayLabel.Caption:='Good Friday';
|
||||||
|
EasterMondayLabel.Caption:='Easter Monday';
|
||||||
|
AscensionDayLabel.Caption:='Ascension Day';
|
||||||
|
PentecostLabel.Caption:='Pentecost';
|
||||||
|
CorpusCristiLabel.Caption:='Corspus Cristi';
|
||||||
|
end else begin
|
||||||
|
LanguageButton.Caption:='English';
|
||||||
|
EndButton.Caption:='Exit';
|
||||||
|
AboutButton.Caption:='Info';
|
||||||
|
CalculateButton.Caption:='Berechne';
|
||||||
|
AshWednesdayLabel.Caption:='Aschermittwoch';
|
||||||
|
YearLabel.Caption:='Jahr';
|
||||||
|
GoodFridayLabel.Caption:='Karfreitag';
|
||||||
|
EasterMondayLabel.Caption:='Ostermontag';
|
||||||
|
AscensionDayLabel.Caption:='Himmelfahrt';
|
||||||
|
PentecostLabel.Caption:='Pfingsten';
|
||||||
|
CorpusCristiLabel.Caption:='Fronleichnam';
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
FUNCTION TForm1.CalcEasterday(aYear: WORD): TDateTime;
|
||||||
|
VAR
|
||||||
|
A, B, C, D, E, F, G, H, I, J, K, L, M, N: INTEGER;
|
||||||
|
vDay, vMonth: WORD;
|
||||||
|
BEGIN
|
||||||
|
A := aYear MOD 19;
|
||||||
|
B := aYear DIV 100;
|
||||||
|
C := aYear MOD 100;
|
||||||
|
|
||||||
|
D := B DIV 4;
|
||||||
|
E := B MOD 4;
|
||||||
|
|
||||||
|
F := (B + 8) DIV 25;
|
||||||
|
G := (B - F + 1) DIV 3;
|
||||||
|
H := (19 * A + B - D - G + 15) MOD 30;
|
||||||
|
I := C DIV 4;
|
||||||
|
J := C MOD 4;
|
||||||
|
K := (32 + 2 * E + 2 * I - H - J) MOD 7;
|
||||||
|
L := (A + 11 * H + 22 * K) DIV 451;
|
||||||
|
M := (H + K - 7 * L + 114) DIV 31;
|
||||||
|
N := (H + K - 7 * L + 114) MOD 31;
|
||||||
|
|
||||||
|
vDay := N + 1;
|
||||||
|
IF M = 3 THEN vMonth := 3 ELSE vMonth := 4;
|
||||||
|
Result := EncodeDate(aYear, vMonth, vDay);
|
||||||
|
END;
|
||||||
|
|
||||||
|
INITIALIZATION
|
||||||
|
{$I main.lrs}
|
||||||
|
|
||||||
|
END.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user