From 6e39efcc25d16a9dc944bac11111d1d30227a614 Mon Sep 17 00:00:00 2001 From: Ivan Mahonin Date: Jan 18 2019 14:37:19 +0000 Subject: lazarus: text-effect --- diff --git a/lazarus/text-effect/project1.ico b/lazarus/text-effect/project1.ico new file mode 100644 index 0000000..0341321 Binary files /dev/null and b/lazarus/text-effect/project1.ico differ diff --git a/lazarus/text-effect/project1.lpi b/lazarus/text-effect/project1.lpi new file mode 100644 index 0000000..3afe492 --- /dev/null +++ b/lazarus/text-effect/project1.lpi @@ -0,0 +1,79 @@ + + + + + + + + + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <Icon Value="0"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="LCL"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="project1.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="unit1.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Unit1"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="project1"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <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/lazarus/text-effect/project1.lpr b/lazarus/text-effect/project1.lpr new file mode 100644 index 0000000..58c35dc --- /dev/null +++ b/lazarus/text-effect/project1.lpr @@ -0,0 +1,21 @@ +program project1; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, Unit1 + { you can add units after this }; + +{$R *.res} + +begin + RequireDerivedFormResource:=True; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + diff --git a/lazarus/text-effect/project1.res b/lazarus/text-effect/project1.res new file mode 100644 index 0000000..e994dfa Binary files /dev/null and b/lazarus/text-effect/project1.res differ diff --git a/lazarus/text-effect/unit1.lfm b/lazarus/text-effect/unit1.lfm new file mode 100644 index 0000000..308088b --- /dev/null +++ b/lazarus/text-effect/unit1.lfm @@ -0,0 +1,36 @@ +object Form1: TForm1 + Left = 373 + Height = 147 + Top = 306 + Width = 451 + Caption = 'Form1' + ClientHeight = 147 + ClientWidth = 451 + LCLVersion = '1.6.2.0' + object Edit1: TEdit + Left = 8 + Height = 32 + Top = 8 + Width = 344 + Font.Name = 'Monospace' + ParentFont = False + TabOrder = 0 + Text = 'Edit1' + end + object Edit2: TEdit + Left = 8 + Height = 32 + Top = 48 + Width = 344 + Font.Name = 'Monospace' + ParentFont = False + TabOrder = 1 + Text = 'Edit2' + end + object Timer1: TTimer + Interval = 100 + OnTimer = Timer1Timer + left = 16 + top = 94 + end +end diff --git a/lazarus/text-effect/unit1.pas b/lazarus/text-effect/unit1.pas new file mode 100644 index 0000000..f593d1e --- /dev/null +++ b/lazarus/text-effect/unit1.pas @@ -0,0 +1,54 @@ +unit Unit1; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, + ExtCtrls; + +type + + { TForm1 } + + TForm1 = class(TForm) + Edit1: TEdit; + Edit2: TEdit; + Timer1: TTimer; + procedure Timer1Timer(Sender: TObject); + private + { private declarations } + public + { public declarations } + end; + +var + Form1: TForm1; + +implementation + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.Timer1Timer(Sender: TObject); +var + i, j: integer; + text1, text2, chars: string; +begin + text1 := Edit1.Text; + text2 := Edit2.Text; + chars := 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' + text1; + + for i := 1 to length(text1) do begin + if length(text2) < i then text2 := text2 + '*'; + for j := 0 to 0 do + if text1[i] <> text2[i] then text2[i] := chars[Random(length(chars)+1)]; + end; + + Edit2.Text := copy(text2, 1, length(text1)); +end; + +end. +