exctrls: Initial commit.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7464 8e941d3f-bd1b-0410-a28a-d453659cc2b4
80
components/exctrls/examples/CheckCtrlsEx/demo.lpi
Normal file
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="demo"/>
|
||||
<Scaled Value="True"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<RequiredPackages>
|
||||
<Item>
|
||||
<PackageName Value="ExCtrlsPkg"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item>
|
||||
</RequiredPackages>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="demo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="MainForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="demo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
25
components/exctrls/examples/CheckCtrlsEx/demo.lpr
Normal file
@ -0,0 +1,25 @@
|
||||
program demo;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}
|
||||
cthreads,
|
||||
{$ENDIF}
|
||||
{$IFDEF HASAMIGA}
|
||||
athreads,
|
||||
{$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(TMainForm, MainForm);
|
||||
Application.Run;
|
||||
end.
|
||||
|
314
components/exctrls/examples/CheckCtrlsEx/main.lfm
Normal file
@ -0,0 +1,314 @@
|
||||
object MainForm: TMainForm
|
||||
Left = 353
|
||||
Height = 295
|
||||
Top = 132
|
||||
Width = 735
|
||||
Caption = 'Extended Check Controls Demo'
|
||||
ClientHeight = 295
|
||||
ClientWidth = 735
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '2.1.0.0'
|
||||
object CheckBoxEx1: TCheckBoxEx
|
||||
AnchorSideLeft.Control = Label1
|
||||
AnchorSideTop.Control = Label1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 16
|
||||
Height = 19
|
||||
Top = 35
|
||||
Width = 412
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy'
|
||||
TabOrder = 0
|
||||
TabStop = True
|
||||
end
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 16
|
||||
Width = 142
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Top = 16
|
||||
Caption = 'AutoSize + no WordWrap'
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object Label2: TLabel
|
||||
AnchorSideLeft.Control = CheckBoxEx1
|
||||
AnchorSideTop.Control = CheckBoxEx1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 78
|
||||
Width = 125
|
||||
BorderSpacing.Top = 24
|
||||
Caption = 'AutoSize + WordWrap'
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object CheckBoxEx2: TCheckBoxEx
|
||||
AnchorSideLeft.Control = CheckBoxEx1
|
||||
AnchorSideTop.Control = Label2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 16
|
||||
Height = 49
|
||||
Top = 97
|
||||
Width = 172
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy'
|
||||
TabOrder = 1
|
||||
TabStop = True
|
||||
WordWrap = True
|
||||
end
|
||||
object Label3: TLabel
|
||||
AnchorSideLeft.Control = CheckBoxEx1
|
||||
AnchorSideTop.Control = CheckBoxEx2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 170
|
||||
Width = 199
|
||||
BorderSpacing.Top = 24
|
||||
Caption = 'AutoSize + WordWrap + Top Layout'
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object CheckBoxEx3: TCheckBoxEx
|
||||
AnchorSideLeft.Control = CheckBoxEx1
|
||||
AnchorSideTop.Control = Label3
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 16
|
||||
Height = 49
|
||||
Top = 189
|
||||
Width = 172
|
||||
BorderSpacing.Top = 4
|
||||
ButtonLayout = tlTop
|
||||
Caption = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy'
|
||||
TabOrder = 2
|
||||
TabStop = True
|
||||
WordWrap = True
|
||||
end
|
||||
object Label4: TLabel
|
||||
AnchorSideTop.Control = Label2
|
||||
Left = 282
|
||||
Height = 15
|
||||
Top = 78
|
||||
Width = 171
|
||||
Caption = 'Item colors by code at runtime'
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object RadioGroupEx1: TRadioGroupEx
|
||||
AnchorSideLeft.Control = Label4
|
||||
AnchorSideTop.Control = Label4
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 282
|
||||
Height = 105
|
||||
Top = 101
|
||||
Width = 198
|
||||
BorderSpacing.Top = 8
|
||||
Caption = 'RadioGroupEx1'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 1
|
||||
ItemIndex = 1
|
||||
Items.Strings = (
|
||||
'This item is red.'
|
||||
'The second item is green.'
|
||||
'The third item is blue.'
|
||||
'The last item is disabled.'
|
||||
)
|
||||
TabOrder = 3
|
||||
end
|
||||
object Label5: TLabel
|
||||
AnchorSideTop.Control = Label4
|
||||
Left = 536
|
||||
Height = 15
|
||||
Top = 78
|
||||
Width = 159
|
||||
Caption = 'User-provided button glyphs'
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object RadioButtonEx1: TRadioButtonEx
|
||||
Left = 536
|
||||
Height = 19
|
||||
Top = 108
|
||||
Width = 83
|
||||
Caption = 'First option'
|
||||
Checked = True
|
||||
Images = ImageList1
|
||||
State = cbChecked
|
||||
TabOrder = 4
|
||||
TabStop = True
|
||||
OnGetImageIndex = RadioButtonEx1GetImageIndex
|
||||
end
|
||||
object RadioButtonEx2: TRadioButtonEx
|
||||
Left = 536
|
||||
Height = 19
|
||||
Top = 137
|
||||
Width = 100
|
||||
Caption = 'Second option'
|
||||
Images = ImageList1
|
||||
TabOrder = 5
|
||||
TabStop = True
|
||||
OnGetImageIndex = RadioButtonEx1GetImageIndex
|
||||
end
|
||||
object RadioButtonEx3: TRadioButtonEx
|
||||
Left = 536
|
||||
Height = 19
|
||||
Top = 168
|
||||
Width = 88
|
||||
Caption = 'Third option'
|
||||
Images = ImageList1
|
||||
TabOrder = 6
|
||||
TabStop = True
|
||||
OnGetImageIndex = RadioButtonEx1GetImageIndex
|
||||
end
|
||||
object Label6: TLabel
|
||||
AnchorSideLeft.Control = RadioGroupEx1
|
||||
AnchorSideTop.Control = RadioGroupEx1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 282
|
||||
Height = 15
|
||||
Top = 214
|
||||
Width = 34
|
||||
BorderSpacing.Top = 8
|
||||
Caption = 'Label6'
|
||||
ParentColor = False
|
||||
end
|
||||
object ImageList1: TImageList
|
||||
Scaled = True
|
||||
left = 496
|
||||
top = 16
|
||||
Bitmap = {
|
||||
4C7A020000001000000010000000E60300000000000078DA8D935D6C536518C7
|
||||
DF33ED9D3743442643C39041748CB181C292F1D1CE2D6CDD706E6C7183D94264
|
||||
C446091B048D892E5E60480DEB5205D62E5E907061160C423B865AF6413B9833
|
||||
284847BB6EDE80EB8A4E34125CA1F3EFF3BCDDE9DAD92DBEC92F7DCEF3FC7FEF
|
||||
7B4E4E8F10094BD9A03DE9341DBE85DDFBBDA837DD44EDBE9FB063CF0D54197F
|
||||
44F6C6CF9C9C11C917B9271CC76C21ACD0FE22C9D4455959C88CA1CE1440D6CB
|
||||
9F3A92ECA1ACDF7CDC613E1142567110D92541AC290D22671AAEB9B77ADB38AA
|
||||
1BFC7861BD357E0F25AFE0B8E3A316CAEA43C8A68CF5D45FF2775D794812EB95
|
||||
8C23B7FC2EB61B7C58B52EBAC7C27443F3879FDCC14B15BF228F66EEC13078F5
|
||||
0E84915B7657C2352F9E716643E56F28A9F562D1B3C6E6279718CC6F7F308E82
|
||||
EA096CAC9C4047E7DF50D7A52B6189BA78C6994D3513287A7D947D339D6F36BD
|
||||
3F0E6DED3D68EBEE21BFEA77CA4D62F6E21ECF38C3B0FFF47351BFE1DD208AEA
|
||||
FF4431C1BFF9957F602C341573B9E69E9A9139D55F6A30BF793088D2DDF72545
|
||||
BBEEE3CAB5C87FCEE71ECF38A3275EA9F959FA4F2D359A8D8D637875EF03EA3F
|
||||
4870BFEC7A2451977B3022331594D555ABBEE1C84ED30876BC154645C3249CDD
|
||||
51DFD53F85B23D9392DEABD167E9A41967AA4D61E4EB6FB07F84DEE1E2557916
|
||||
774DC3086ADF7984CA7D0FD1763A42FB3DA4EB285C73AF8A6675FB232828F722
|
||||
23FB989BDDE9FF51FACADC16F76BC600DE689AC2AE0311D43726C23D43D33FD8
|
||||
B47D4875D3E3FF837CBD22A7C5ADDFE9C7DEF790942D15495D11BFC7F339164F
|
||||
9ECE8D5CED65ACDDD287359B7BB1BA204A46768B670E377E0F7EA6AC39583C8F
|
||||
2BFD4587F5CED2EE5694765B66D10A9ECD77F6C243DB9C65DE4E08A71DC2614B
|
||||
847A3CE34CB2675F40FD62AF03A28BDCAFDB9373B11DC5430E2C48DC4349A56B
|
||||
EDD05710DF92EB6A9F13CD792B1E3F67C556CAA6AA7B142E6FDEEA3F07D14D6E
|
||||
CFDC280E0BFAEE8CA29750CE5B201D72852EC3BCD64767F7D9A1B9609588CB76
|
||||
792DA15A715AA4A7AEA3DFB990E327875CE645FF59A474B5CAFD19A5CB02D16F
|
||||
97701DEF72CDD9ACE1B3313F33700647075C0919E51B8B64B6CB3D316047E6F0
|
||||
9998BF6CA4032997287B7B26DB737B44127369A6B8C8FD9EDEE5A00DCB021DD3
|
||||
FE72F392D12F207EB041E9493C2FE15C9A71465C8B221D72898F9F193E05719D
|
||||
9EF73AEDD197781FF25CEAF16C063BA4432EBDC3344D63A127D5F739C44D9B44
|
||||
71D3BB228FE15AEDAB70961D76D5EFEEB1469DE7091FDD83AF0DE2561B34575B
|
||||
255CC7A01967389BECFB4F39A0F368FC272102B61986A7A19A679C99EFFB174D
|
||||
85FD4AE721A4380F26C03D9EFD8FEF3F6D9EEF3F6DB6FB2F39580CCE
|
||||
}
|
||||
BitmapAdv = {
|
||||
4C69010000004C7A020000002000000020000000430A00000000000078DACD97
|
||||
795054D915C65F25A19C542A3553339615AD4A659BD1191718371050947D5790
|
||||
551041C57D1F1DC744333571665CE2246A748406CC188D8995983F26A9718786
|
||||
6E166D7014DC978C0BB6343474E3C6A6F0E59CFBBAE98547D3A07FE4557DF56E
|
||||
DF7BCEF73BEFDEF76EBF27497D1E1EEFFA96D48FF029C1089F62BC3BA944E83D
|
||||
5F8BFC4A30D24EA3FC591A8C9E5C52CFB9D2CB1D1EEF4C28D2EFDD7F17855A13
|
||||
0E1E35E2AB230DC83B6CC09707EAB03BFF21FE90ABC7B63DF7F1E91F6BF1F18E
|
||||
7BF8F5E777F0C98EFF227B753546FA16EB5FA2068FB789AD3A7017278ACC181E
|
||||
F4003F9BF200BF08204D7D805FB2A6B1F4F8152B508FB703E5F388103DD67D72
|
||||
1B59CB2FD29C0CA8866E76A1B619A342F5181EACC7C8308BC29535CA727E2FF4
|
||||
2146853DC4AA4D3791B1E4427F6B1073BE27EF0E4EAA4D1813F150F88D897C08
|
||||
AF28F7E449B1A323EAE85C87A51B6E2075C179776BF07867A25AFFC597B7F1F5
|
||||
C926F2AAA36BAA13674F8BDE8FAEC3D81865F198354ECE31602CF52D587B0D49
|
||||
5955745FBAACC163B8B75ABF6DD72DFCE36B23F9D5D3351BC8D38051742DDEF1
|
||||
06216E8F8D3160FC7447719F73DCFB3106E1336E7A3D32575C415C46253D178A
|
||||
35788C20F6E6DFDFC0A1A3F59830A341E48DA73C4FAAC18BAEA3F971979017FD
|
||||
E6BE0934E61D276B82352ED22E2ECA16C77E1367D4236DF16544A7EAF8D9B4AF
|
||||
C183D6A661D396EB28385C079FB8068CA7786F3A8FE3DA490D8D9DB01E0DC64E
|
||||
9AD37A9A977A11C3E236F7F158771CE588FCD87AF8C4535CBC1193661A9138B7
|
||||
066189E7E01950D260A9E18D11B49F1CFD8F1E3E331B3191E27C13E458CFA806
|
||||
3C7E6AF3B41EF5E43D2196B831B2B85DDFD8338E73D983BDFC12C937B1097E09
|
||||
4D48C8ACC298295A309B3484F7B6BFFDEB3E26C699E09FD88829C98DE23C2ED6
|
||||
086D653B940E03F1C64619850C0A6C3E38973DAC9E53929B3039B919F1193AE2
|
||||
6B983F44F0E9FA0F1EB98749096604A434616AAA2C3FAA774C841185656D8AFE
|
||||
77F59D424A07E7702E7B58FD5801A98F303DFDACF5FA059FF7F3FC4377E09FD4
|
||||
8C69B34C084C93C56DFF2413CD61238ACA95E741E9E058CEE15C7BBFC0343302
|
||||
D31FD33D5841EBEFC8DFB7FF3BAAEF1182D3CD08996D13FF0E4831D3F3D084A2
|
||||
8ABE6BE0188EE51C67AF90D9CD08C97882F024273EFD8FEDCAB945B53D416846
|
||||
33C2E6388AFBA6A69AE97932E198BAA357368F710CC72AF984CD7984F0ACA708
|
||||
4D2873E0F3FFE8F6DD37A9BEA708A798884C4785653CC2D49466BA7F9AF1A0EE
|
||||
45AF7C1EE3188EE51C679F88CCC7889CFB0C41339CF8F4BFFDD917D768BC0551
|
||||
739F20DA4E91994F109C46F332FB311A9ABAFA9C7F8EE158CEE1DC6807BFA788
|
||||
9DDF86809852073EBF377CBCE52AB15B11339F636445CF7B4AD7C173F2048DA6
|
||||
2EB7EF3F8EE51CCE658FD86ECF6798B1B01D7E111A27BE061B7E7709B1D9ED98
|
||||
BE8062487C8ECC7A8628CAEF8D7D4AFB5C48B10673976047653DEBF69CB1A005
|
||||
F18B3BE01D5A02AFA9767C7A5F5ABDB106718B3A3073512BA905710B5B1031A7
|
||||
050FEBBB7AD95B68AD139F09715BE9B87EBB93D68098E4C59E098B5B91B4EC05
|
||||
C606163BF0F97D6DD987D5485ADA8EC4252CAA8162A3693D74D53DBD4B89179C
|
||||
D682E9D9AD42DC56AAA1B2A6537830973D9397B52365F9736233BFB49B3F7A72
|
||||
91292EA30AF3565DA7F1768AEBA03ADB10BFA88DD6B015E5E76DDEA666D073DD
|
||||
4AF3D346F5CAE236CF9BC96C63730EE7CE248F64F24A5DD181D4E534F76195C4
|
||||
D6C02B406DB2F0F93F60E248BF53C6D8341D32975F45DAAA0ECC5AF19CE2692E
|
||||
16B7D31CB6A1AABA13CF5A40D7D1868445ED626CD60A59DC9EB9A85D8C710CC7
|
||||
720EE7F278FAAAE7485BF91CDEE13A6297D0DE7BC6C84C0B9BFF038792FCB886
|
||||
C8D473F43F7D0519AB5F209D94B6B20329CBF8BEE8A075EC40F252AA8DFAD257
|
||||
398AFB788C63383665B9DC9FB1E60566AFE924365D7700B34F33DBCFC2EC7E07
|
||||
B0FCF61DE97FCA189E7816C9F32F61CE079D42196B9E532DB26693F8B79266AF
|
||||
B6C5F1EFCCB59DA42E67B6AF135B72AE6114D5101C5F81F8CC1ACC5DD785791F
|
||||
76216BED8B7E8973E6AD037C68BD3DFB662BD610105B8698F46A64AF07B23F02
|
||||
E6AFEF724BD91B20727C22FAC556A8E1B4D13FB214E1C917B1F837C0924D0AFA
|
||||
ADACA576E2D801B27BD4307AF269A34F7829FCA80EDF082D268569E013AA8177
|
||||
4831C6D33E326E9A9AEE693571D418ED5F44EF9645A2CDCFD800D9CE35F8794E
|
||||
519B79BFEE4DBC97F55080DAAC709F4B03AC819FD52052B09B0AB2E40C7D15DF
|
||||
C0D6F7D47EEA8D57C096F9DBC31BA4AD2190B60643DA12E45A1CC3B19CF32AAE
|
||||
FDF3E0BA59E70F635FDB5DEC6BF90EFB5AFB10C7502CE770EE4BAD3DE52755FD
|
||||
051F18BE85F4CD7E48FF56B9278AE51CCE1D600D821D5F75002B0D95908E13FB
|
||||
9B3C48C7F2DD13C7520EE7B2473F6B10ECE9BAAFB0D4A0837482D8C7C9EF6441
|
||||
FFC43994CB1EECE5660D821DADFB33161ACE413A45EC13E473AA60603A497371
|
||||
5AF662CF3E6A10EC08DD7ECC3554403AC31EF9F279202AB4E80C7BC89EECDD4B
|
||||
0DC40EA90BD515604E5DB99C739AEEA3C2FC97900A83F76EC25B7B37925FAEE8
|
||||
CB30948319CC72F8EFDF1E6E0CAA2CC0AC3A7A2754D37811CDB93A7F602AE673
|
||||
2E5EDBF551F7BBD8A05DEBC933478CA712239058CCECDEDBB68662D9637AC68A
|
||||
2DECE2FC81A984CFB918B47B7D8F7751EEE3BA98B19459C4ECDE5769BFCA7E44
|
||||
F77A91CAE6A321692DD258FAFA9432DB7ABCC96B51AC9259BC475AF76A6A6799
|
||||
E99E2B51C9BC5296BC7E2C6E8B3E6D2F1263B9629E5D1DE25ED0AA90D95CD183
|
||||
9F6EA6FB4E93277B9539AE1FB7B94F2AB3D666A73239BE2FB6F0E0EBD0E621BD
|
||||
B9DC891F8A44137D0F9411BF42E5C076B8872AA8860AE2955BC4ED8ABED9DDB9
|
||||
9C438C2466C9EBDFCD8F336928260F6FEDD9E8DAE72CF99CCDB7C84DB635A742
|
||||
E6C7994A7AF0A31AD590742A97FC6EBFCA1C21B7D83A8AD5D1BC9EB3E8AC4A66
|
||||
39F1431B0B055FAACC559C7FFB43DAB956C8257BA7B5CE3C996FD53995CC72E0
|
||||
8761AAF114A42A1A3F4FFA3647E40FF4106CF2105E554EA27A048B98F67C3FE3
|
||||
493B3EE9C2C06A106CCA151EE715440CC172E24F301EA7BC3C9B2E92AAFB5EE3
|
||||
1EEB4D3922F742EF122C077E38BC1A8E41AA299073ADAA26D5B857836053ACC8
|
||||
B9E842C4102C62DAF1CD43CB77E0E7B547E51AAAF36CAA215D72BD1662CE2946
|
||||
C456BB1079338359CCB4FFFE973687340DD16EC34F6BFF09E932D57029CFA62B
|
||||
2CE51A049BC644CC2517224FF66606B39CBEFF87896F15EA7F53BB153FA93D02
|
||||
E92AED1597F36C62FFAB39786DA7DDBE4C6DEE1363975D88BCD893BD2D6C3F0B
|
||||
D3F9FB5FD4F0BA760B06D7FE1DD235AAE1AACAA6EBA41B3918FCA74D42DC167D
|
||||
575D883CD88B3DEDD8AEBEFF450D3FD67E86D7EFD33BFC4DAAFF9ACA26E6DDB4
|
||||
E8BACA71CC5994CB1EECD5075BB1861F6A3EC58FEE1D82748B6AB8A1B2C9CABF
|
||||
E14294C3B9ECE1265BB1060FCD660CAAA5EF88DBB416B7F3E45A5C8963289673
|
||||
38B79F6C851A429BBEA7DD8CEFEBFF8A1FD41E744B1CCB399CFB12DFE0B61AB6
|
||||
44344BDB22E43DC31D712CE7BC9AEFFF612FF1FD3FECFFFDFBFF7F3E2F3290
|
||||
}
|
||||
end
|
||||
end
|
73
components/exctrls/examples/CheckCtrlsEx/main.pas
Normal file
@ -0,0 +1,73 @@
|
||||
unit main;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
|
||||
ExCheckCtrls;
|
||||
|
||||
type
|
||||
|
||||
{ TMainForm }
|
||||
|
||||
TMainForm = class(TForm)
|
||||
CheckBoxEx1: TCheckBoxEx;
|
||||
CheckBoxEx2: TCheckBoxEx;
|
||||
CheckBoxEx3: TCheckBoxEx;
|
||||
ImageList1: TImageList;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
Label4: TLabel;
|
||||
Label5: TLabel;
|
||||
Label6: TLabel;
|
||||
RadioButtonEx1: TRadioButtonEx;
|
||||
RadioButtonEx2: TRadioButtonEx;
|
||||
RadioButtonEx3: TRadioButtonEx;
|
||||
RadioGroupEx1: TRadioGroupEx;
|
||||
procedure CheckBox1Change(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure RadioButtonEx1GetImageIndex(Sender: TObject; AHover, APressed,
|
||||
AEnabled: Boolean; AState: TCheckboxState; var AImgIndex: Integer);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
MainForm: TMainForm;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TMainForm }
|
||||
|
||||
procedure TMainForm.CheckBox1Change(Sender: TObject);
|
||||
begin
|
||||
CheckboxEx1.AutoSize := true;
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
RadioGroupEx1.Buttons[0].ThemedCaption := false;
|
||||
RadioGroupEx1.Buttons[1].ThemedCaption := false;
|
||||
RadioGroupEx1.Buttons[2].ThemedCaption := false;
|
||||
RadioGroupEx1.Buttons[0].Font.Color := clRed;
|
||||
RadioGroupEx1.Buttons[1].Font.Color := clGreen;
|
||||
RadioGroupEx1.Buttons[2].Font.Color := clBlue;
|
||||
RadioGroupEx1.Buttons[3].Enabled := false;
|
||||
Label6.Caption := 'This box contains ' + IntToStr(RadioGroupEx1.ButtonCount) + ' buttons';
|
||||
end;
|
||||
|
||||
procedure TMainForm.RadioButtonEx1GetImageIndex(Sender: TObject; AHover,
|
||||
APressed, AEnabled: Boolean; AState: TCheckboxState; var AImgIndex: Integer);
|
||||
begin
|
||||
if AState = cbChecked then AImgIndex := 1 else AImgIndex := 0;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
83
components/exctrls/examples/CurrSpinEditEx/InterestCalc.lpi
Normal file
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="InterestCalc"/>
|
||||
<Scaled Value="True"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<RequiredPackages>
|
||||
<Item>
|
||||
<PackageName Value="LazControls"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<PackageName Value="ExCtrlsPkg"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item>
|
||||
</RequiredPackages>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="InterestCalc.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="main.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="MainForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="InterestCalc"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
25
components/exctrls/examples/CurrSpinEditEx/InterestCalc.lpr
Normal file
@ -0,0 +1,25 @@
|
||||
program InterestCalc;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}
|
||||
cthreads,
|
||||
{$ENDIF}
|
||||
{$IFDEF HASAMIGA}
|
||||
athreads,
|
||||
{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, main, lazcontrols
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TMainForm, MainForm);
|
||||
Application.Run;
|
||||
end.
|
||||
|
156
components/exctrls/examples/CurrSpinEditEx/main.lfm
Normal file
@ -0,0 +1,156 @@
|
||||
object MainForm: TMainForm
|
||||
Left = 353
|
||||
Height = 223
|
||||
Top = 132
|
||||
Width = 304
|
||||
AutoSize = True
|
||||
BorderStyle = bsSingle
|
||||
Caption = 'Savings calculator'
|
||||
ClientHeight = 223
|
||||
ClientWidth = 304
|
||||
OnCreate = Calculate
|
||||
LCLVersion = '2.1.0.0'
|
||||
object sePayment: TCurrSpinEditEx
|
||||
AnchorSideLeft.Control = Label1
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
Left = 168
|
||||
Height = 23
|
||||
Top = 24
|
||||
Width = 103
|
||||
BorderSpacing.Top = 24
|
||||
BorderSpacing.Right = 24
|
||||
MaxLength = 0
|
||||
TabOrder = 0
|
||||
OnChange = Calculate
|
||||
CurrencyFormat = secfValSpaceCurr
|
||||
CurrencyString = '€'
|
||||
Decimals = 2
|
||||
DecimalSeparator = '.'
|
||||
MaxValue = 0
|
||||
MinValue = 0
|
||||
NegCurrencyFormat = sencfMinusValSpaceCurr
|
||||
NullValue = 0
|
||||
ThousandSeparator = ','
|
||||
Value = 100
|
||||
end
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = sePayment
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 24
|
||||
Height = 15
|
||||
Top = 28
|
||||
Width = 136
|
||||
BorderSpacing.Left = 24
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Amount saved per month'
|
||||
ParentColor = False
|
||||
end
|
||||
object seInterestRate: TFloatSpinEditEx
|
||||
AnchorSideLeft.Control = sePayment
|
||||
Left = 168
|
||||
Height = 23
|
||||
Top = 57
|
||||
Width = 103
|
||||
MaxLength = 0
|
||||
TabOrder = 1
|
||||
OnChange = Calculate
|
||||
Increment = 0.1
|
||||
MinValue = 0
|
||||
NullValue = 0
|
||||
Value = 2
|
||||
end
|
||||
object seYears: TSpinEditEx
|
||||
AnchorSideLeft.Control = sePayment
|
||||
Left = 168
|
||||
Height = 23
|
||||
Top = 88
|
||||
Width = 103
|
||||
MaxLength = 0
|
||||
TabOrder = 2
|
||||
OnChange = Calculate
|
||||
Value = 10
|
||||
end
|
||||
object Label2: TLabel
|
||||
AnchorSideTop.Control = seInterestRate
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = seInterestRate
|
||||
Left = 77
|
||||
Height = 15
|
||||
Top = 61
|
||||
Width = 83
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Interest rate (%)'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label3: TLabel
|
||||
AnchorSideTop.Control = seYears
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = seYears
|
||||
Left = 133
|
||||
Height = 15
|
||||
Top = 92
|
||||
Width = 27
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Years'
|
||||
ParentColor = False
|
||||
end
|
||||
object Bevel1: TBevel
|
||||
AnchorSideLeft.Control = sePayment
|
||||
AnchorSideTop.Control = seYears
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = sePayment
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 168
|
||||
Height = 8
|
||||
Top = 123
|
||||
Width = 103
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 12
|
||||
Shape = bsBottomLine
|
||||
end
|
||||
object seFutureValue: TCurrSpinEditEx
|
||||
AnchorSideLeft.Control = sePayment
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 168
|
||||
Height = 23
|
||||
Top = 147
|
||||
Width = 103
|
||||
BorderSpacing.Top = 16
|
||||
BorderSpacing.Bottom = 24
|
||||
Font.Style = [fsBold]
|
||||
MaxLength = 0
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
TabOrder = 3
|
||||
CurrencyFormat = secfValSpaceCurr
|
||||
CurrencyString = '€'
|
||||
Decimals = 2
|
||||
DecimalSeparator = '.'
|
||||
MaxValue = 0
|
||||
MinValue = 0
|
||||
NegCurrencyFormat = sencfMinusValSpaceCurr
|
||||
NullValue = 0
|
||||
ThousandSeparator = ','
|
||||
UpDownVisible = False
|
||||
Value = 0
|
||||
end
|
||||
object Label4: TLabel
|
||||
AnchorSideTop.Control = seFutureValue
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = seFutureValue
|
||||
Left = 90
|
||||
Height = 15
|
||||
Top = 151
|
||||
Width = 70
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Future value'
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
end
|
48
components/exctrls/examples/CurrSpinEditEx/main.pas
Normal file
@ -0,0 +1,48 @@
|
||||
unit main;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
|
||||
SpinEx, ExEditCtrls;
|
||||
|
||||
type
|
||||
|
||||
{ TMainForm }
|
||||
|
||||
TMainForm = class(TForm)
|
||||
Bevel1: TBevel;
|
||||
sePayment: TCurrSpinEditEx;
|
||||
seFutureValue: TCurrSpinEditEx;
|
||||
seInterestRate: TFloatSpinEditEx;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
Label4: TLabel;
|
||||
seYears: TSpinEditEx;
|
||||
procedure Calculate(Sender: TObject);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
MainForm: TMainForm;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
procedure TMainForm.Calculate(Sender: TObject);
|
||||
begin
|
||||
seFutureValue.Value := -FutureValue(seInterestRate.Value/100, seYears.Value, sePayment.Value*12, 0.0, ptEndOfPeriod);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
51
components/exctrls/exctrlspkg.lpk
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<Package Version="5">
|
||||
<PathDelim Value="\"/>
|
||||
<Name Value="ExCtrlsPkg"/>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<Author Value="Lazarus team"/>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<OtherUnitFiles Value="source"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
</CompilerOptions>
|
||||
<Description Value="Extended standard controls:
|
||||
- CurrencyEdit
|
||||
- TRadioButton, TCheckbox, TRadioGroup and TCheckGroup: drawn by ThemeServices/Canvas, not by widgetset, button/text layout, wordwrap, user-provided check images"/>
|
||||
<License Value="LGPL with linking exception (like Lazarus LCL)."/>
|
||||
<Files Count="3">
|
||||
<Item1>
|
||||
<Filename Value="source\excheckctrls.pas"/>
|
||||
<UnitName Value="ExCheckCtrls"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Filename Value="source\exeditctrls.pas"/>
|
||||
<UnitName Value="exeditctrls"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Filename Value="source\exctrlsreg.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="ExCtrlsReg"/>
|
||||
</Item3>
|
||||
</Files>
|
||||
<RequiredPkgs Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="LazControls"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPkgs>
|
||||
<UsageOptions>
|
||||
<UnitPath Value="$(PkgOutDir)"/>
|
||||
</UsageOptions>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
</Package>
|
||||
</CONFIG>
|
22
components/exctrls/exctrlspkg.pas
Normal file
@ -0,0 +1,22 @@
|
||||
{ This file was automatically created by Lazarus. Do not edit!
|
||||
This source is only used to compile and install the package.
|
||||
}
|
||||
|
||||
unit ExCtrlsPkg;
|
||||
|
||||
{$warn 5023 off : no warning about unused units}
|
||||
interface
|
||||
|
||||
uses
|
||||
ExCheckCtrls, ExEditCtrls, ExCtrlsReg, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterUnit('ExCtrlsReg', @ExCtrlsReg.Register);
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterPackage('ExCtrlsPkg', @Register);
|
||||
end.
|
15
components/exctrls/images/imagelist.txt
Normal file
@ -0,0 +1,15 @@
|
||||
tradiobuttonex.png
|
||||
tradiobuttonex_150.png
|
||||
tradiobuttonex_200.png
|
||||
tcheckboxex.png
|
||||
tcheckboxex_150.png
|
||||
tcheckboxex_200.png
|
||||
tradiogroupex.png
|
||||
tradiogroupex_150.png
|
||||
tradiogroupex_200.png
|
||||
tcheckgroupex.png
|
||||
tcheckgroupex_150.png
|
||||
tcheckgroupex_200.png
|
||||
tcurrspineditex.png
|
||||
tcurrspineditex_150.png
|
||||
tcurrspineditex_200.png
|
1
components/exctrls/images/make_res.bat
Normal file
@ -0,0 +1 @@
|
||||
lazres ..\source\exctrlsreg.res @imagelist.txt
|
BIN
components/exctrls/images/tcheckboxex.png
Normal file
After Width: | Height: | Size: 695 B |
BIN
components/exctrls/images/tcheckboxex_150.png
Normal file
After Width: | Height: | Size: 776 B |
BIN
components/exctrls/images/tcheckboxex_200.png
Normal file
After Width: | Height: | Size: 957 B |
BIN
components/exctrls/images/tcheckgroupex.png
Normal file
After Width: | Height: | Size: 754 B |
BIN
components/exctrls/images/tcheckgroupex_150.png
Normal file
After Width: | Height: | Size: 672 B |
BIN
components/exctrls/images/tcheckgroupex_200.png
Normal file
After Width: | Height: | Size: 879 B |
BIN
components/exctrls/images/tcurrspineditex.png
Normal file
After Width: | Height: | Size: 759 B |
BIN
components/exctrls/images/tcurrspineditex_150.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
components/exctrls/images/tcurrspineditex_200.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
components/exctrls/images/tradiobuttonex.png
Normal file
After Width: | Height: | Size: 768 B |
BIN
components/exctrls/images/tradiobuttonex_150.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
components/exctrls/images/tradiobuttonex_200.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
components/exctrls/images/tradiogroupex.png
Normal file
After Width: | Height: | Size: 670 B |
BIN
components/exctrls/images/tradiogroupex_150.png
Normal file
After Width: | Height: | Size: 785 B |
BIN
components/exctrls/images/tradiogroupex_200.png
Normal file
After Width: | Height: | Size: 923 B |
BIN
components/exctrls/source/checkctrlsreg.res
Normal file
2177
components/exctrls/source/excheckctrls.pas
Normal file
31
components/exctrls/source/exctrlsreg.pas
Normal file
@ -0,0 +1,31 @@
|
||||
unit ExCtrlsReg;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
ExCheckCtrls, ExEditCtrls;
|
||||
|
||||
{$R exctrlsreg.res}
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('ExCtrls', [
|
||||
TCheckboxEx, TRadioButtonEx, TCheckGroupEx, TRadioGroupEx
|
||||
]);
|
||||
RegisterComponents('LazControls', [
|
||||
TCurrSpinEditEx
|
||||
]);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
BIN
components/exctrls/source/exctrlsreg.res
Normal file
404
components/exctrls/source/exeditctrls.pas
Normal file
@ -0,0 +1,404 @@
|
||||
unit ExEditCtrls;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
{.$define debug_editctrls}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Controls, SpinEx;
|
||||
|
||||
type
|
||||
{ TCustomCurrEditEx }
|
||||
TSpinEditCurrencyFormat = (
|
||||
secfCurrVal, // 0: $1
|
||||
secfValCurr, // 1: 1$
|
||||
secfCurrSpaceVal, // 2: $ 1
|
||||
secfValSpaceCurr // 3: 1 $
|
||||
);
|
||||
TSpinEditNegCurrencyFormat = (
|
||||
sencfParCurrValPar, // 0: ($1)
|
||||
sencfMinusCurrVal, // 1: -1$
|
||||
sencfCurrMinusVal, // 2: $-1
|
||||
sencfCurrValMinus, // 3: $1-
|
||||
sencfParValCurrPar, // 4: (1$)
|
||||
sencfMinusValCurr, // 5: -1$
|
||||
sencfValMinusCurr, // 6: 1-$
|
||||
sencfValCurrMinus, // 7: 1$-
|
||||
sencfMinusValSpaceCurr, // 8: -1 $
|
||||
sencfMinusCurrSpaceVal, // 9: -$ 1
|
||||
sencfValSpaceCurrMinus, //10: 1 $-
|
||||
sencfCurrSpaceValMinus, //11: $ 1-
|
||||
sencfCurrSpaceMinusVal, //12: $ -1
|
||||
sencfValMinusSpaceCurr, //13: 1- $
|
||||
sencfParCurrSpaceValPar, //14: ($ 1)
|
||||
sencfParValSpaceCurrPar //15: (1 $)
|
||||
);
|
||||
|
||||
TSpinEditCurrencyDecimals = 0..4;
|
||||
|
||||
TCustomCurrSpinEditEx = class(specialize TSpinEditExBase<Currency>)
|
||||
private
|
||||
FCurrencyString: String;
|
||||
FDecimals: TSpinEditCurrencyDecimals;
|
||||
FCurrencyFormat: TSpinEditCurrencyFormat;
|
||||
FDecimalSeparator: Char;
|
||||
FNegCurrencyFormat: TSpinEditNegCurrencyFormat;
|
||||
FThousandSeparator: Char;
|
||||
function IsIncrementStored: Boolean;
|
||||
procedure SetCurrencyFormat(AValue: TSpinEditCurrencyFormat);
|
||||
procedure SetCurrencyString(AValue: String);
|
||||
procedure SetDecimals(AValue: TSpinEditCurrencyDecimals);
|
||||
procedure SetDecimalSeparator(AValue: Char);
|
||||
procedure SetNegCurrencyFormat(AValue: TSpinEditNegCurrencyFormat);
|
||||
procedure SetThousandSeparator(AValue: Char);
|
||||
protected
|
||||
procedure EditKeyPress(var Key: char); override;
|
||||
function SafeInc(AValue: Currency): Currency; override;
|
||||
function SafeDec(AValue: Currency): Currency; override;
|
||||
function TextIsNumber(const S: String; out ANumber: Currency): Boolean; override;
|
||||
function TryExtractCurrency(AText: String; out AValue: Currency;
|
||||
const AFormatSettings: TFormatSettings): Boolean;
|
||||
function UsedFormatSettings: TFormatSettings;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
function ValueToStr(const AValue: Currency): String; override;
|
||||
procedure ResetFormatSettings;
|
||||
function StrToValue(const S: String): Currency; override;
|
||||
public
|
||||
property Increment stored IsIncrementStored;
|
||||
property CurrencyFormat: TSpinEditCurrencyFormat
|
||||
read FCurrencyFormat write SetCurrencyFormat;
|
||||
property CurrencyString: String
|
||||
read FCurrencyString write SetCurrencyString;
|
||||
property Decimals: TSpinEditCurrencyDecimals
|
||||
read FDecimals write SetDecimals;
|
||||
property DecimalSeparator: Char
|
||||
read FDecimalSeparator write SetDecimalSeparator;
|
||||
property NegCurrencyFormat: TSpinEditNegCurrencyFormat
|
||||
read FNegCurrencyFormat write SetNegCurrencyFormat;
|
||||
property ThousandSeparator: Char
|
||||
read FThousandSeparator write SetThousandSeparator;
|
||||
end;
|
||||
|
||||
{ TCurrSpinEdit }
|
||||
|
||||
TCurrSpinEditEx = class(TCustomCurrSpinEditEx)
|
||||
public
|
||||
property AutoSelected;
|
||||
published
|
||||
//From TCustomEdit
|
||||
property AutoSelect;
|
||||
property AutoSizeHeightIsEditHeight;
|
||||
property AutoSize default True;
|
||||
property Action;
|
||||
property Align;
|
||||
property Alignment default taRightJustify;
|
||||
property Anchors;
|
||||
property BiDiMode;
|
||||
property BorderSpacing;
|
||||
property BorderStyle default bsNone;
|
||||
property CharCase;
|
||||
property Color;
|
||||
property Constraints;
|
||||
property Cursor;
|
||||
property DirectInput;
|
||||
property EchoMode;
|
||||
property Enabled;
|
||||
property FocusOnBuddyClick;
|
||||
property Font;
|
||||
property Hint;
|
||||
property Layout;
|
||||
property MaxLength;
|
||||
property NumbersOnly;
|
||||
property ParentBiDiMode;
|
||||
property ParentColor;
|
||||
property ParentFont;
|
||||
property ParentShowHint;
|
||||
property PopupMenu;
|
||||
property ReadOnly;
|
||||
property ShowHint;
|
||||
property TabOrder;
|
||||
property TabStop;
|
||||
property TextHint;
|
||||
property Visible;
|
||||
|
||||
property OnChange;
|
||||
property OnClick;
|
||||
property OnDblClick;
|
||||
property OnDragDrop;
|
||||
property OnDragOver;
|
||||
property OnContextPopup;
|
||||
property OnEditingDone;
|
||||
property OnEndDrag;
|
||||
property OnEnter;
|
||||
property OnExit;
|
||||
property OnKeyDown;
|
||||
property OnKeyPress;
|
||||
property OnKeyUp;
|
||||
property OnMouseDown;
|
||||
property OnMouseEnter;
|
||||
property OnMouseLeave;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
property OnMouseWheel;
|
||||
property OnMouseWheelDown;
|
||||
property OnMouseWheelUp;
|
||||
property OnStartDrag;
|
||||
property OnUTF8KeyPress;
|
||||
|
||||
//From TCustomFloatSpinEditEx
|
||||
property ArrowKeys;
|
||||
property CurrencyFormat;
|
||||
property CurrencyString;
|
||||
property Decimals;
|
||||
property DecimalSeparator;
|
||||
property Increment;
|
||||
property MaxValue;
|
||||
property MinValue;
|
||||
property MinRepeatValue;
|
||||
property NegCurrencyFormat;
|
||||
property NullValue;
|
||||
property NullValueBehaviour;
|
||||
property Spacing;
|
||||
property ThousandSeparator;
|
||||
property UpDownVisible;
|
||||
property Value;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
LCLProc;
|
||||
|
||||
resourcestring
|
||||
RsDecSepMustNotMatchThSep = 'Decimal and thousand separators most not be equal.';
|
||||
|
||||
const
|
||||
Digits = ['0'..'9'];
|
||||
AllowedControlChars = [#8, #9, ^C, ^X, ^V, ^Z];
|
||||
|
||||
{ TCustomCurrSpinEditEx }
|
||||
|
||||
constructor TCustomCurrSpinEditEx.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FMaxValue := 0;
|
||||
FMinValue := 0; // --> disable Max/Min check by default
|
||||
ResetFormatSettings;
|
||||
end;
|
||||
|
||||
procedure TCustomCurrSpinEditEx.EditKeyPress(var Key: char);
|
||||
begin
|
||||
inherited EditKeyPress(Key);
|
||||
{Disallow any key that is not a digit or -
|
||||
Tab, BackSpace, Cut, Paste, Copy, Undo of course should be passed onto inherited KeyPress
|
||||
}
|
||||
if not (Key in (Digits + AllowedControlChars + ['-'])) then Key := #0;
|
||||
if (Key = '-') and IsLimited and (MinValue >= 0) then Key := #0;
|
||||
end;
|
||||
|
||||
procedure TCustomCurrSpinEditEx.ResetFormatSettings;
|
||||
begin
|
||||
FDecimals := DefaultFormatSettings.CurrencyDecimals;
|
||||
FCurrencyFormat := TSpinEditCurrencyFormat(DefaultFormatSettings.CurrencyFormat);
|
||||
FCurrencyString := DefaultFormatSettings.CurrencyString;
|
||||
FDecimalSeparator := DefaultFormatSettings.DecimalSeparator;
|
||||
FNegCurrencyFormat := TSpinEditNegCurrencyFormat(DefaultFormatSettings.NegCurrFormat);
|
||||
FThousandSeparator := DefaultFormatSettings.ThousandSeparator;
|
||||
end;
|
||||
|
||||
function TCustomCurrSpinEditEx.IsIncrementStored: Boolean;
|
||||
begin
|
||||
Result := FIncrement <> 1;
|
||||
end;
|
||||
|
||||
function TCustomCurrSpinEditEx.SafeInc(AValue: Currency): Currency;
|
||||
begin
|
||||
if (AValue > 0) and (AValue > MaxCurrency-FIncrement) then
|
||||
Result := MaxCurrency
|
||||
else
|
||||
Result := AValue + FIncrement;
|
||||
end;
|
||||
|
||||
function TCustomCurrSpinEditEx.SafeDec(AValue: Currency): Currency;
|
||||
begin
|
||||
if (AValue < 0) and (MinCurrency + FIncrement > AValue) then
|
||||
Result := MinCurrency
|
||||
else
|
||||
Result := AValue - FIncrement;
|
||||
end;
|
||||
|
||||
procedure TCustomCurrSpinEditEx.SetCurrencyFormat(AValue: TSpinEditCurrencyFormat);
|
||||
begin
|
||||
if AValue = FCurrencyFormat then exit;
|
||||
FCurrencyFormat := AValue;
|
||||
UpdateControl;
|
||||
end;
|
||||
|
||||
procedure TCustomCurrSpinEditEx.SetCurrencyString(AValue: string);
|
||||
begin
|
||||
if AValue = FCurrencyString then exit;
|
||||
FCurrencyString := AValue;
|
||||
UpdateControl;
|
||||
end;
|
||||
|
||||
procedure TCustomCurrSpinEditEx.SetDecimals(AValue: TSpinEditCurrencyDecimals);
|
||||
begin
|
||||
if AValue = FDecimals then exit;
|
||||
FDecimals := AValue;
|
||||
UpdateControl;
|
||||
end;
|
||||
|
||||
procedure TCustomCurrSpinEditEx.SetDecimalSeparator(AValue: char);
|
||||
begin
|
||||
if AValue = FDecimalSeparator then exit;
|
||||
if (AValue = FThousandSeparator) and (ComponentState = []) then
|
||||
raise Exception.Create(RsDecSepMustNotMatchThSep);
|
||||
FDecimalSeparator := AValue;
|
||||
UpdateControl;
|
||||
end;
|
||||
|
||||
procedure TCustomCurrSpinEditEx.SetNegCurrencyFormat(
|
||||
AValue: TSpinEditNegCurrencyFormat);
|
||||
begin
|
||||
if AValue = FNegCurrencyFormat then exit;
|
||||
FNegCurrencyFormat := AValue;
|
||||
UpdateControl;
|
||||
end;
|
||||
|
||||
procedure TCustomCurrSpinEditEx.SetThousandSeparator(AValue: char);
|
||||
begin
|
||||
if AValue = FThousandSeparator then exit;
|
||||
if AValue = FDecimalSeparator then
|
||||
raise Exception.Create(RsDecSepMustNotMatchThSep);
|
||||
FThousandSeparator := AValue;
|
||||
UpdateControl;
|
||||
end;
|
||||
|
||||
function TCustomCurrSpinEditEx.TextIsNumber(const S: String; out ANumber: Currency
|
||||
): Boolean;
|
||||
var
|
||||
C: Currency;
|
||||
begin
|
||||
{$ifdef debug_editctrls}
|
||||
DbgOut(['TCustomSpinEditEx.TextIsNumber: S = "',S,'" Result = ']);
|
||||
{$endif}
|
||||
|
||||
try
|
||||
Result := TryExtractCurrency(S, C, UsedFormatSettings);
|
||||
// Result := TryStrToCurr(S, C);
|
||||
ANumber := C;
|
||||
except
|
||||
Result := False;
|
||||
end;
|
||||
{$ifdef debug_editctrls}
|
||||
debugln([Result]);
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
function TCustomCurrSpinEditEx.TryExtractCurrency(AText: String;
|
||||
out AValue: Currency; const AFormatSettings: TFormatSettings): Boolean;
|
||||
type
|
||||
TParenthesis = (pNone, pOpen, pClose);
|
||||
var
|
||||
isNeg: Boolean;
|
||||
parenth: TParenthesis;
|
||||
P: PChar;
|
||||
PEnd: PChar;
|
||||
s: String;
|
||||
n: Integer;
|
||||
begin
|
||||
Result := false;
|
||||
if AText = '' then
|
||||
exit;
|
||||
isNeg := false;
|
||||
parenth := pNone;
|
||||
SetLength(s, Length(AText));
|
||||
n := 1;
|
||||
P := @AText[1];
|
||||
PEnd := @AText[Length(AText)];
|
||||
while P <= PEnd do begin
|
||||
if (P^ in ['0'..'9']) or (P^ in [AFormatSettings.DecimalSeparator]) then
|
||||
begin
|
||||
s[n] := P^;
|
||||
inc(n);
|
||||
end else
|
||||
if P^ = '-' then
|
||||
isNeg := true
|
||||
else
|
||||
if P^ = '(' then begin
|
||||
isNeg := true;
|
||||
parenth := pOpen;
|
||||
end else
|
||||
if P^ = ')' then begin
|
||||
if not IsNeg then
|
||||
exit;
|
||||
parenth := pClose;
|
||||
end;
|
||||
inc(P);
|
||||
end;
|
||||
if IsNeg and (parenth = pOpen) then
|
||||
exit;
|
||||
SetLength(s, n-1);
|
||||
Result := TryStrToCurr(s, AValue, AFormatSettings);
|
||||
if Result and isNeg then AValue := -AValue;
|
||||
end;
|
||||
|
||||
function TCustomCurrSpinEditEx.UsedFormatSettings: TFormatSettings;
|
||||
begin
|
||||
Result := DefaultFormatSettings;
|
||||
Result.CurrencyFormat := ord(FCurrencyFormat);
|
||||
Result.NegCurrFormat := ord(FNegCurrencyFormat);
|
||||
Result.ThousandSeparator := FThousandSeparator;
|
||||
Result.DecimalSeparator := FDecimalSeparator;
|
||||
Result.CurrencyString := FCurrencyString;
|
||||
Result.CurrencyDecimals := FDecimals;
|
||||
end;
|
||||
|
||||
function TCustomCurrSpinEditEx.ValueToStr(const AValue: Currency): String;
|
||||
begin
|
||||
Result := Format('%m', [AValue], UsedFormatSettings);
|
||||
end;
|
||||
|
||||
function TCustomCurrSpinEditEx.StrToValue(const S: String): Currency;
|
||||
var
|
||||
Def, N: Currency;
|
||||
begin
|
||||
{$ifdef debug_editctrls}
|
||||
debugln(['TCustomSpinEditEx.StrToValue: S="',S,'"']);
|
||||
{$endif}
|
||||
case FNullValueBehaviour of
|
||||
nvbShowTextHint: Def := FNullValue;
|
||||
nvbLimitedNullValue: Def := GetLimitedValue(FNullValue);
|
||||
nvbMinValue: Def := FMinValue;
|
||||
nvbMaxValue: Def := MaxValue;
|
||||
nvbInitialValue: Def := FInitialValue;
|
||||
end;
|
||||
try
|
||||
if (FNullValueBehaviour = nvbShowTextHint)then
|
||||
begin
|
||||
if TextIsNumber(S, N)
|
||||
then
|
||||
Result := N
|
||||
else
|
||||
Result := Def;
|
||||
end
|
||||
else
|
||||
if TextIsNumber(S, N) then
|
||||
Result := GetLimitedValue(N)
|
||||
else
|
||||
Result := Def
|
||||
// Result := GetLimitedValue(StrToCurrDef(S, Def));
|
||||
except
|
||||
Result := Def;
|
||||
end;
|
||||
{$ifdef debug_editctrls}
|
||||
debugln([' Result=',(Result)]);
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|