diff --git a/first_gui/first_gui.ico b/first_gui/first_gui.ico new file mode 100644 index 0000000..0341321 Binary files /dev/null and b/first_gui/first_gui.ico differ diff --git a/first_gui/first_gui.lpi b/first_gui/first_gui.lpi new file mode 100644 index 0000000..ef87836 --- /dev/null +++ b/first_gui/first_gui.lpi @@ -0,0 +1,79 @@ + + + + + + + + + <Scaled Value="True"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <XPManifest> + <DpiAware Value="True"/> + </XPManifest> + <Icon Value="0"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="LCL"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="first_gui.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="umain.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="first_gui"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf2Set"/> + </Debugging> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/first_gui/first_gui.lpr b/first_gui/first_gui.lpr new file mode 100644 index 0000000..074e82c --- /dev/null +++ b/first_gui/first_gui.lpr @@ -0,0 +1,22 @@ +program first_gui; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, umain + { you can add units after this }; + +{$R *.res} + +begin + RequireDerivedFormResource:=True; + Application.Title:='first_gui'; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + diff --git a/first_gui/umain.lfm b/first_gui/umain.lfm new file mode 100644 index 0000000..d54fa12 --- /dev/null +++ b/first_gui/umain.lfm @@ -0,0 +1,22 @@ +object Form1: TForm1 + Left = 811 + Height = 240 + Top = 410 + Width = 320 + BorderIcons = [biSystemMenu] + Caption = 'Form1' + ClientHeight = 240 + ClientWidth = 320 + LCLVersion = '2.0.12.0' + object DateBtn: TButton + Left = 70 + Height = 52 + Top = 94 + Width = 181 + Caption = 'Show Date' + Font.Style = [fsBold] + OnClick = DateBtnClick + ParentFont = False + TabOrder = 0 + end +end diff --git a/first_gui/umain.pas b/first_gui/umain.pas new file mode 100644 index 0000000..982bb9e --- /dev/null +++ b/first_gui/umain.pas @@ -0,0 +1,42 @@ +unit umain; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls; + +type + + { TForm1 } + + TForm1 = class(TForm) + DateBtn: TButton; + procedure DateBtnClick(Sender: TObject); + private + function TodayAsString: string; + public + + end; + +var + Form1: TForm1; + +implementation + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.DateBtnClick(Sender: TObject); +begin + ShowMessageFmt('Today is %s', [TodayAsString]); +end; + +function TForm1.TodayAsString: string; +begin + Result := FormatDateTime('dddd, mmm d, yyyy', Now); +end; + +end.