diff --git a/components/industrialstuff/Example/LEDNumberDemo/LEDNumberDemo.lpi b/components/industrialstuff/Example/LEDNumberDemo/LEDNumberDemo.lpi new file mode 100644 index 000000000..6b4be8da1 --- /dev/null +++ b/components/industrialstuff/Example/LEDNumberDemo/LEDNumberDemo.lpi @@ -0,0 +1,83 @@ + + + + + + + + + + + + <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"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="industrial"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="LEDNumberDemo.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="main.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="LEDNumberDemo"/> + </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/components/industrialstuff/Example/LEDNumberDemo/LEDNumberDemo.lpr b/components/industrialstuff/Example/LEDNumberDemo/LEDNumberDemo.lpr new file mode 100644 index 000000000..c0c31b364 --- /dev/null +++ b/components/industrialstuff/Example/LEDNumberDemo/LEDNumberDemo.lpr @@ -0,0 +1,22 @@ +program LEDNumberDemo; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX} + cthreads, + {$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, main + { you can add units after this }; + +{$R *.res} + +begin + RequireDerivedFormResource:=True; + Application.Scaled:=True; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + diff --git a/components/industrialstuff/Example/LEDNumberDemo/main.lfm b/components/industrialstuff/Example/LEDNumberDemo/main.lfm new file mode 100644 index 000000000..2724b4ee8 --- /dev/null +++ b/components/industrialstuff/Example/LEDNumberDemo/main.lfm @@ -0,0 +1,137 @@ +object Form1: TForm1 + Left = 347 + Height = 240 + Top = 148 + Width = 529 + AutoSize = True + Caption = 'LEDNumber demo' + ClientHeight = 240 + ClientWidth = 529 + OnCreate = FormCreate + LCLVersion = '2.1.0.0' + object Panel1: TPanel + Left = 0 + Height = 55 + Top = 0 + Width = 529 + Align = alTop + AutoSize = True + BevelOuter = bvNone + ClientHeight = 55 + ClientWidth = 529 + TabOrder = 0 + object lblCaption: TLabel + AnchorSideLeft.Control = Panel1 + AnchorSideTop.Control = edCaption + AnchorSideTop.Side = asrCenter + Left = 8 + Height = 15 + Top = 12 + Width = 42 + BorderSpacing.Left = 8 + Caption = 'Caption' + ParentColor = False + end + object edCaption: TEdit + AnchorSideLeft.Control = lblCaption + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Panel1 + Left = 62 + Height = 23 + Top = 8 + Width = 132 + BorderSpacing.Left = 12 + BorderSpacing.Top = 8 + OnChange = edCaptionChange + TabOrder = 0 + Text = '-0.1234' + end + object cbZeroToO: TCheckBox + AnchorSideLeft.Control = edCaption + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = edCaption + AnchorSideTop.Side = asrCenter + Left = 218 + Height = 19 + Top = 10 + Width = 120 + BorderSpacing.Left = 24 + BorderSpacing.Right = 8 + Caption = 'Replace zero by ''O''' + OnChange = cbZeroToOChange + TabOrder = 1 + end + object cbSlanted: TCheckBox + AnchorSideLeft.Control = cbZeroToO + AnchorSideTop.Control = sbSize + AnchorSideTop.Side = asrCenter + Left = 218 + Height = 19 + Top = 36 + Width = 59 + Caption = 'Slanted' + OnChange = cbSlantedChange + TabOrder = 2 + end + object lblSize: TLabel + AnchorSideLeft.Control = lblCaption + AnchorSideTop.Control = sbSize + AnchorSideTop.Side = asrCenter + Left = 8 + Height = 15 + Top = 38 + Width = 20 + Caption = 'Size' + ParentColor = False + end + object sbSize: TScrollBar + AnchorSideLeft.Control = edCaption + AnchorSideTop.Control = edCaption + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = edCaption + AnchorSideRight.Side = asrBottom + Left = 62 + Height = 17 + Top = 37 + Width = 132 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Top = 6 + Max = 5 + Min = 2 + PageSize = 0 + Position = 2 + TabOrder = 3 + OnChange = sbSizeChange + end + end + object LEDNumber1: TLEDNumber + AnchorSideLeft.Control = Panel1 + AnchorSideTop.Control = Bevel1 + AnchorSideTop.Side = asrBottom + Left = 8 + Height = 30 + Top = 78 + Width = 170 + BorderSpacing.Left = 8 + BorderSpacing.Top = 12 + BorderSpacing.Right = 12 + BorderSpacing.Bottom = 12 + Caption = 'LEDNumber1' + end + object Bevel1: TBevel + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = Panel1 + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 8 + Height = 3 + Top = 63 + Width = 513 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 8 + BorderSpacing.Top = 8 + BorderSpacing.Right = 8 + Shape = bsBottomLine + end +end diff --git a/components/industrialstuff/Example/LEDNumberDemo/main.pas b/components/industrialstuff/Example/LEDNumberDemo/main.pas new file mode 100644 index 000000000..a0e83e90e --- /dev/null +++ b/components/industrialstuff/Example/LEDNumberDemo/main.pas @@ -0,0 +1,83 @@ +unit main; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, + LedNumber; + +type + + { TForm1 } + + TForm1 = class(TForm) + Bevel1: TBevel; + cbZeroToO: TCheckBox; + cbSlanted: TCheckBox; + edCaption: TEdit; + lblSize: TLabel; + lblCaption: TLabel; + LEDNumber1: TLEDNumber; + Panel1: TPanel; + sbSize: TScrollBar; + procedure cbSlantedChange(Sender: TObject); + procedure cbZeroToOChange(Sender: TObject); + procedure edCaptionChange(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure sbSizeChange(Sender: TObject); + private + procedure UpdateLED; + + public + + end; + +var + Form1: TForm1; + +implementation + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.cbSlantedChange(Sender: TObject); +begin + LEDNumber1.Slanted := cbSlanted.Checked; +end; + +procedure TForm1.cbZeroToOChange(Sender: TObject); +begin + LEDNumber1.ZeroToO := cbZeroToO.Checked; +end; + +procedure TForm1.edCaptionChange(Sender: TObject); +begin + UpdateLED; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + UpdateLED; +end; + +procedure TForm1.sbSizeChange(Sender: TObject); +begin + LEDNumber1.Size := sbSize.Position; +end; + +procedure TForm1.UpdateLED; +var + i, n: Integer; +begin + n := 0; + for i := 1 to Length(edCaption.Text) do + if not (edCaption.Text[i] in ['.', ',']) then inc(n); + LEDNumber1.Columns := n; + LEDNumber1.Caption := edCaption.Text; +end; + +end. +