jvcllaz: Add demo for TJvValidateEdit
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6666 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
f9640cf3bc
commit
28898c8317
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="JvFormatEditDemo"/>
|
||||
<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="2">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="JvCustomLazR"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="JvFormatEditDemo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="MainFrm.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="frmValidateEditDemo"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="../../bin/JvFormatEditDemo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<OtherUnitFiles Value="."/>
|
||||
<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>
|
@ -0,0 +1,15 @@
|
||||
program JvFormatEditDemo;
|
||||
|
||||
uses
|
||||
Forms, Interfaces,
|
||||
MainFrm in 'MainFrm.pas' {frmValidateEditDemo};
|
||||
|
||||
{$R *.RES}
|
||||
|
||||
begin
|
||||
Application.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TfrmValidateEditDemo, frmValidateEditDemo);
|
||||
Application.Run;
|
||||
end.
|
||||
|
716
components/jvcllaz/examples/JvValidateEdit/MainFrm.lfm
Normal file
716
components/jvcllaz/examples/JvValidateEdit/MainFrm.lfm
Normal file
@ -0,0 +1,716 @@
|
||||
object frmValidateEditDemo: TfrmValidateEditDemo
|
||||
Left = 371
|
||||
Height = 567
|
||||
Top = 232
|
||||
Width = 547
|
||||
AutoSize = True
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'JvValidateEdit Demo'
|
||||
ClientHeight = 567
|
||||
ClientWidth = 547
|
||||
Color = clBtnFace
|
||||
Constraints.MinHeight = 170
|
||||
Constraints.MinWidth = 325
|
||||
DefaultMonitor = dmDesktop
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '2.1.0.0'
|
||||
Scaled = False
|
||||
object GroupBox1: TGroupBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 16
|
||||
Height = 269
|
||||
Top = 16
|
||||
Width = 487
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 16
|
||||
Caption = 'Properties'
|
||||
ClientHeight = 251
|
||||
ClientWidth = 483
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = cbDisplayFormat
|
||||
AnchorSideTop.Control = GroupBox1
|
||||
Left = 12
|
||||
Height = 13
|
||||
Top = 8
|
||||
Width = 75
|
||||
BorderSpacing.Top = 8
|
||||
Caption = 'Display Format:'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object Label3: TLabel
|
||||
AnchorSideLeft.Control = cbDisplayFormat
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Control = edCheckChars
|
||||
Left = 12
|
||||
Height = 13
|
||||
Top = 109
|
||||
Width = 64
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Top = 11
|
||||
BorderSpacing.Bottom = 4
|
||||
Caption = 'Check Chars:'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object Label4: TLabel
|
||||
AnchorSideTop.Control = seDecimalPlaces
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 236
|
||||
Height = 13
|
||||
Top = 105
|
||||
Width = 69
|
||||
Caption = 'Decimal Places'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object Label6: TLabel
|
||||
AnchorSideLeft.Control = cbDisplayFormat
|
||||
AnchorSideTop.Control = edDisplayPrefix
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 13
|
||||
Top = 54
|
||||
Width = 65
|
||||
Caption = 'Display Prefix'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object Label7: TLabel
|
||||
AnchorSideLeft.Control = cbDisplayFormat
|
||||
AnchorSideTop.Control = edDisplaySuffix
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 13
|
||||
Top = 79
|
||||
Width = 65
|
||||
Caption = 'Display Suffix'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object cbDisplayFormat: TComboBox
|
||||
AnchorSideLeft.Control = GroupBox1
|
||||
AnchorSideTop.Control = Label1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 21
|
||||
Top = 25
|
||||
Width = 193
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Top = 4
|
||||
DropDownCount = 24
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ItemHeight = 13
|
||||
OnChange = cbDisplayFormatChange
|
||||
OnKeyPress = cbDisplayFormatKeyPress
|
||||
ParentFont = False
|
||||
Style = csDropDownList
|
||||
TabOrder = 0
|
||||
end
|
||||
object chkHasMaxValue: TCheckBox
|
||||
AnchorSideLeft.Control = chkZeroEmpty
|
||||
AnchorSideTop.Control = chkZeroEmpty
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 221
|
||||
Height = 19
|
||||
Top = 52
|
||||
Width = 85
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Has Maximum'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
OnClick = chkHasMaxValueClick
|
||||
ParentFont = False
|
||||
TabOrder = 1
|
||||
end
|
||||
object chkHasMinValue: TCheckBox
|
||||
AnchorSideLeft.Control = chkZeroEmpty
|
||||
AnchorSideTop.Control = edMinValue
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 221
|
||||
Height = 19
|
||||
Top = 77
|
||||
Width = 81
|
||||
Caption = 'Has Minimum'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
OnClick = chkHasMinValueClick
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
end
|
||||
object seDecimalPlaces: TSpinEdit
|
||||
AnchorSideLeft.Control = edMaxValue
|
||||
AnchorSideTop.Control = edMinValue
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 318
|
||||
Height = 21
|
||||
Top = 101
|
||||
Width = 49
|
||||
BorderSpacing.Top = 4
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
MaxValue = 0
|
||||
OnChange = seDecimalPlacesChange
|
||||
ParentFont = False
|
||||
TabOrder = 3
|
||||
Value = 2
|
||||
end
|
||||
object chkZeroEmpty: TCheckBox
|
||||
AnchorSideLeft.Control = cbDisplayFormat
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = GroupBox1
|
||||
Left = 221
|
||||
Height = 19
|
||||
Top = 27
|
||||
Width = 89
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Top = 27
|
||||
Caption = 'Empty if Zero?'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
OnClick = chkZeroEmptyClick
|
||||
ParentFont = False
|
||||
TabOrder = 4
|
||||
end
|
||||
object edCheckChars: TEdit
|
||||
AnchorSideLeft.Control = cbDisplayFormat
|
||||
AnchorSideTop.Control = btnCheckChars
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = btnCheckChars
|
||||
Left = 12
|
||||
Height = 21
|
||||
Top = 126
|
||||
Width = 298
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ParentFont = False
|
||||
TabOrder = 5
|
||||
end
|
||||
object btnCheckChars: TButton
|
||||
AnchorSideLeft.Control = edMaxValue
|
||||
AnchorSideTop.Control = seDecimalPlaces
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 318
|
||||
Height = 21
|
||||
Top = 126
|
||||
Width = 49
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'Set'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
OnClick = btnCheckCharsClick
|
||||
ParentFont = False
|
||||
TabOrder = 6
|
||||
end
|
||||
object edDisplayPrefix: TEdit
|
||||
AnchorSideLeft.Control = Label6
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = cbDisplayFormat
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 93
|
||||
Height = 21
|
||||
Top = 50
|
||||
Width = 57
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Top = 4
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ParentFont = False
|
||||
TabOrder = 7
|
||||
end
|
||||
object edDisplaySuffix: TEdit
|
||||
AnchorSideLeft.Control = edDisplayPrefix
|
||||
AnchorSideTop.Control = edDisplayPrefix
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 93
|
||||
Height = 21
|
||||
Top = 75
|
||||
Width = 57
|
||||
BorderSpacing.Top = 4
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ParentFont = False
|
||||
TabOrder = 8
|
||||
end
|
||||
object btnSetDisplayPrefix: TButton
|
||||
AnchorSideLeft.Control = edDisplayPrefix
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = edDisplayPrefix
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 158
|
||||
Height = 21
|
||||
Top = 50
|
||||
Width = 47
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'Set'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
OnClick = btnSetDisplayPrefixClick
|
||||
ParentFont = False
|
||||
TabOrder = 9
|
||||
end
|
||||
object btnSetDisplaySuffix: TButton
|
||||
AnchorSideLeft.Control = btnSetDisplayPrefix
|
||||
AnchorSideTop.Control = edDisplaySuffix
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 158
|
||||
Height = 21
|
||||
Top = 75
|
||||
Width = 47
|
||||
BorderSpacing.Top = 3
|
||||
Caption = 'Set'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
OnClick = btnSetDisplaySuffixClick
|
||||
ParentFont = False
|
||||
TabOrder = 10
|
||||
end
|
||||
object edMaxValue: TEdit
|
||||
AnchorSideLeft.Control = chkHasMaxValue
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = chkHasMaxValue
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 318
|
||||
Height = 21
|
||||
Top = 51
|
||||
Width = 49
|
||||
BorderSpacing.Left = 12
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
OnExit = edMaxValueExit
|
||||
ParentFont = False
|
||||
TabOrder = 11
|
||||
end
|
||||
object edMinValue: TEdit
|
||||
AnchorSideLeft.Control = edMaxValue
|
||||
AnchorSideTop.Control = edMaxValue
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 318
|
||||
Height = 21
|
||||
Top = 76
|
||||
Width = 49
|
||||
BorderSpacing.Top = 4
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
OnExit = edMinValueExit
|
||||
ParentFont = False
|
||||
TabOrder = 12
|
||||
end
|
||||
object GroupBox3: TGroupBox
|
||||
AnchorSideTop.Control = edCheckChars
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 80
|
||||
Top = 159
|
||||
Width = 459
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 12
|
||||
Caption = 'Critical Points'
|
||||
ClientHeight = 62
|
||||
ClientWidth = 455
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ParentFont = False
|
||||
TabOrder = 13
|
||||
object Label9: TLabel
|
||||
AnchorSideLeft.Control = edCPMaxValue
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = colCPAbove
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 307
|
||||
Height = 13
|
||||
Top = 8
|
||||
Width = 31
|
||||
BorderSpacing.Left = 16
|
||||
Caption = 'Colour'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label11: TLabel
|
||||
AnchorSideLeft.Control = Label9
|
||||
AnchorSideTop.Control = colCPBelow
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 307
|
||||
Height = 13
|
||||
Top = 34
|
||||
Width = 31
|
||||
Caption = 'Colour'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label12: TLabel
|
||||
AnchorSideLeft.Control = cbCPCheckPoints
|
||||
AnchorSideBottom.Control = cbCPCheckPoints
|
||||
Left = 12
|
||||
Height = 13
|
||||
Top = 12
|
||||
Width = 65
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Bottom = 4
|
||||
Caption = 'Check Points:'
|
||||
ParentColor = False
|
||||
end
|
||||
object edCPMaxValue: TEdit
|
||||
AnchorSideLeft.Control = chkMaxValueIncluded
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = GroupBox3
|
||||
Left = 242
|
||||
Height = 21
|
||||
Top = 4
|
||||
Width = 49
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Top = 4
|
||||
OnExit = edCPMaxValueExit
|
||||
TabOrder = 0
|
||||
Text = '10'
|
||||
end
|
||||
object colCPAbove: TColorBox
|
||||
AnchorSideLeft.Control = Label9
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = edCPMaxValue
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 342
|
||||
Height = 22
|
||||
Top = 3
|
||||
Width = 105
|
||||
BorderSpacing.Left = 4
|
||||
ItemHeight = 16
|
||||
TabOrder = 1
|
||||
end
|
||||
object edCPMinValue: TEdit
|
||||
AnchorSideLeft.Control = edCPMaxValue
|
||||
AnchorSideTop.Control = edCPMaxValue
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 242
|
||||
Height = 21
|
||||
Top = 29
|
||||
Width = 49
|
||||
BorderSpacing.Top = 4
|
||||
OnExit = edCPMinValueExit
|
||||
TabOrder = 2
|
||||
Text = '-10'
|
||||
end
|
||||
object colCPBelow: TColorBox
|
||||
AnchorSideLeft.Control = colCPAbove
|
||||
AnchorSideTop.Control = edCPMinValue
|
||||
Left = 342
|
||||
Height = 22
|
||||
Top = 29
|
||||
Width = 105
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 6
|
||||
ItemHeight = 16
|
||||
TabOrder = 3
|
||||
end
|
||||
object cbCPCheckPoints: TComboBox
|
||||
AnchorSideLeft.Control = GroupBox3
|
||||
AnchorSideTop.Control = edCPMinValue
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 21
|
||||
Top = 29
|
||||
Width = 89
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Bottom = 12
|
||||
DropDownCount = 24
|
||||
ItemHeight = 13
|
||||
OnChange = cbCPCheckPointsChange
|
||||
Style = csDropDownList
|
||||
TabOrder = 4
|
||||
end
|
||||
object chkMaxValueIncluded: TCheckBox
|
||||
AnchorSideLeft.Control = chkMinValueIncluded
|
||||
AnchorSideTop.Control = edCPMaxValue
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 113
|
||||
Height = 19
|
||||
Top = 5
|
||||
Width = 113
|
||||
Caption = 'Max Value Included'
|
||||
OnClick = chkMaxValueIncludedClick
|
||||
TabOrder = 5
|
||||
end
|
||||
object chkMinValueIncluded: TCheckBox
|
||||
AnchorSideLeft.Control = cbCPCheckPoints
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = edCPMinValue
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 113
|
||||
Height = 19
|
||||
Top = 30
|
||||
Width = 109
|
||||
BorderSpacing.Left = 12
|
||||
Caption = 'Min Value Included'
|
||||
OnClick = chkMinValueIncludedClick
|
||||
TabOrder = 6
|
||||
end
|
||||
end
|
||||
end
|
||||
object GroupBox2: TGroupBox
|
||||
AnchorSideLeft.Control = GroupBox1
|
||||
AnchorSideTop.Control = GroupBox4
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = GroupBox1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 16
|
||||
Height = 124
|
||||
Top = 395
|
||||
Width = 487
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Bottom = 16
|
||||
Caption = 'Set To'
|
||||
ClientHeight = 106
|
||||
ClientWidth = 483
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
TabOrder = 1
|
||||
object Label5: TLabel
|
||||
AnchorSideLeft.Control = GroupBox2
|
||||
AnchorSideTop.Control = edSetTo
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 13
|
||||
Top = 12
|
||||
Width = 26
|
||||
BorderSpacing.Left = 12
|
||||
Caption = 'Value'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object edSetTo: TEdit
|
||||
AnchorSideLeft.Control = Label5
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = GroupBox2
|
||||
Left = 46
|
||||
Height = 21
|
||||
Top = 8
|
||||
Width = 121
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
end
|
||||
object rgSetToType: TRadioGroup
|
||||
AnchorSideLeft.Control = Label5
|
||||
AnchorSideTop.Control = edSetTo
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 49
|
||||
Top = 41
|
||||
Width = 258
|
||||
AutoFill = True
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 12
|
||||
BorderSpacing.Bottom = 16
|
||||
BorderSpacing.InnerBorder = 6
|
||||
Caption = 'as Type'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.HorizontalSpacing = 8
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 4
|
||||
ClientHeight = 31
|
||||
ClientWidth = 254
|
||||
Columns = 4
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ItemIndex = 3
|
||||
Items.Strings = (
|
||||
'Currency'
|
||||
'Float'
|
||||
'Integer'
|
||||
'Text'
|
||||
)
|
||||
ParentFont = False
|
||||
TabOrder = 1
|
||||
end
|
||||
object btnSetTo: TButton
|
||||
AnchorSideLeft.Control = edSetTo
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = edSetTo
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 171
|
||||
Height = 23
|
||||
Top = 7
|
||||
Width = 42
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 4
|
||||
Caption = 'Set'
|
||||
Default = True
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
OnClick = btnSetToClick
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
end
|
||||
object chkAsVariant: TCheckBox
|
||||
AnchorSideLeft.Control = btnSetTo
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = edSetTo
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 229
|
||||
Height = 19
|
||||
Top = 9
|
||||
Width = 68
|
||||
BorderSpacing.Left = 16
|
||||
Caption = 'as Variant'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ParentFont = False
|
||||
TabOrder = 3
|
||||
end
|
||||
object btnSetToPI: TButton
|
||||
AnchorSideLeft.Control = chkAsVariant
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = edSetTo
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 313
|
||||
Height = 23
|
||||
Top = 7
|
||||
Width = 66
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 16
|
||||
Caption = 'Set to pi'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
OnClick = btnSetToPIClick
|
||||
ParentFont = False
|
||||
TabOrder = 4
|
||||
end
|
||||
end
|
||||
object GroupBox4: TGroupBox
|
||||
AnchorSideLeft.Control = GroupBox1
|
||||
AnchorSideTop.Control = GroupBox1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = GroupBox1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 16
|
||||
Height = 78
|
||||
Top = 301
|
||||
Width = 487
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Bottom = 16
|
||||
Caption = 'Validate Edit'
|
||||
ClientHeight = 60
|
||||
ClientWidth = 483
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
object chkValueChanged: TCheckBox
|
||||
AnchorSideTop.Control = JvValidateEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = JvValidateEdit
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = GroupBox4
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 320
|
||||
Height = 19
|
||||
Top = 29
|
||||
Width = 151
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Bottom = 12
|
||||
Caption = 'Message on Value Change?'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
end
|
||||
object JvValidateEdit: TJvValidateEdit
|
||||
AnchorSideLeft.Control = GroupBox4
|
||||
AnchorSideTop.Control = GroupBox4
|
||||
AnchorSideRight.Control = GroupBox4
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 21
|
||||
Top = 4
|
||||
Width = 459
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 12
|
||||
CriticalPoints.MaxValue = 10
|
||||
CriticalPoints.MinValue = -10
|
||||
CriticalPoints.MaxValueIncluded = False
|
||||
CriticalPoints.MinValueIncluded = False
|
||||
DisplayFormat = dfFloat
|
||||
DecimalPlaces = 2
|
||||
EditText = '0'
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Shell Dlg 2'
|
||||
MaxValue = 0
|
||||
MinValue = 0
|
||||
ParentFont = False
|
||||
TabOrder = 1
|
||||
OnCustomValidate = JvValidateEditCustomValidate
|
||||
OnValueChanged = JvValidateEditValueChanged
|
||||
end
|
||||
end
|
||||
end
|
307
components/jvcllaz/examples/JvValidateEdit/MainFrm.pas
Normal file
307
components/jvcllaz/examples/JvValidateEdit/MainFrm.pas
Normal file
@ -0,0 +1,307 @@
|
||||
{******************************************************************
|
||||
|
||||
JEDI-VCL Demo
|
||||
|
||||
Copyright (C) 2002 Project JEDI
|
||||
|
||||
Original author: Christopher Latta
|
||||
|
||||
Contributor(s):
|
||||
|
||||
You may retrieve the latest version of this file at the JEDI-JVCL
|
||||
home page, located at http://jvcl.delphi-jedi.org
|
||||
|
||||
The contents of this file are used with permission, subject to
|
||||
the Mozilla Public License Version 1.1 (the "License"); you may
|
||||
not use this file except in compliance with the License. You may
|
||||
obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/MPL-1_1Final.html
|
||||
|
||||
Software distributed under the License is distributed on an
|
||||
"AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
******************************************************************}
|
||||
|
||||
{
|
||||
A demo for the JvValidateEdit component. You don't need to install the component
|
||||
to run this demo, but the JvValidateEdit and the JvCharStrEditor units
|
||||
must be in the same directory.
|
||||
}
|
||||
unit MainFrm;
|
||||
|
||||
{$MODE OBJFPC}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
||||
StdCtrls, ComCtrls, Spin, ExtCtrls, ColorBox,
|
||||
JvValidateEdit;
|
||||
|
||||
type
|
||||
|
||||
{ TfrmValidateEditDemo }
|
||||
|
||||
TfrmValidateEditDemo = class(TForm)
|
||||
btnSetToPI: TButton;
|
||||
GroupBox4: TGroupBox;
|
||||
GroupBox1: TGroupBox;
|
||||
Label1: TLabel;
|
||||
Label3: TLabel;
|
||||
cbDisplayFormat: TComboBox;
|
||||
chkHasMaxValue: TCheckBox;
|
||||
chkHasMinValue: TCheckBox;
|
||||
seDecimalPlaces: TSpinEdit;
|
||||
Label4: TLabel;
|
||||
chkZeroEmpty: TCheckBox;
|
||||
edCheckChars: TEdit;
|
||||
GroupBox2: TGroupBox;
|
||||
Label5: TLabel;
|
||||
edSetTo: TEdit;
|
||||
rgSetToType: TRadioGroup;
|
||||
btnSetTo: TButton;
|
||||
chkValueChanged: TCheckBox;
|
||||
btnCheckChars: TButton;
|
||||
Label6: TLabel;
|
||||
Label7: TLabel;
|
||||
edDisplayPrefix: TEdit;
|
||||
edDisplaySuffix: TEdit;
|
||||
btnSetDisplayPrefix: TButton;
|
||||
btnSetDisplaySuffix: TButton;
|
||||
edMaxValue: TEdit;
|
||||
edMinValue: TEdit;
|
||||
GroupBox3: TGroupBox;
|
||||
edCPMaxValue: TEdit;
|
||||
Label9: TLabel;
|
||||
colCPAbove: TColorBox;
|
||||
edCPMinValue: TEdit;
|
||||
Label11: TLabel;
|
||||
colCPBelow: TColorBox;
|
||||
Label12: TLabel;
|
||||
cbCPCheckPoints: TComboBox;
|
||||
chkAsVariant: TCheckBox;
|
||||
JvValidateEdit: TJvValidateEdit;
|
||||
chkMaxValueIncluded: TCheckBox;
|
||||
chkMinValueIncluded: TCheckBox;
|
||||
procedure btnSetToPIClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure cbDisplayFormatKeyPress(Sender: TObject; var Key: Char);
|
||||
procedure cbDisplayFormatChange(Sender: TObject);
|
||||
procedure seDecimalPlacesChange(Sender: TObject);
|
||||
procedure chkHasMaxValueClick(Sender: TObject);
|
||||
procedure chkHasMinValueClick(Sender: TObject);
|
||||
procedure btnSetToClick(Sender: TObject);
|
||||
procedure chkZeroEmptyClick(Sender: TObject);
|
||||
procedure btnCheckCharsClick(Sender: TObject);
|
||||
procedure btnSetDisplayPrefixClick(Sender: TObject);
|
||||
procedure btnSetDisplaySuffixClick(Sender: TObject);
|
||||
procedure edCPMaxValueExit(Sender: TObject);
|
||||
procedure edCPMinValueExit(Sender: TObject);
|
||||
procedure colCPAboveChange(Sender: TObject);
|
||||
procedure colCPBelowChange(Sender: TObject);
|
||||
procedure cbCPCheckPointsChange(Sender: TObject);
|
||||
procedure edMaxValueExit(Sender: TObject);
|
||||
procedure edMinValueExit(Sender: TObject);
|
||||
procedure JvValidateEditCustomValidate(Sender: TObject; Key: Char;
|
||||
const AText: String; const Pos: Integer; var IsValid: Boolean);
|
||||
procedure JvValidateEditValueChanged(Sender: TObject);
|
||||
procedure chkMaxValueIncludedClick(Sender: TObject);
|
||||
procedure chkMinValueIncludedClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmValidateEditDemo: TfrmValidateEditDemo;
|
||||
|
||||
implementation
|
||||
uses
|
||||
TypInfo,
|
||||
JvJCLUtils, JvJVCLUtils; // for D5
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
|
||||
procedure TfrmValidateEditDemo.FormCreate(Sender: TObject);
|
||||
var
|
||||
df: TJvValidateEditDisplayFormat;
|
||||
cp: TJvValidateEditCriticalPointsCheck;
|
||||
begin
|
||||
for df := Low(TJvValidateEditDisplayFormat) to High(TJvValidateEditDisplayFormat) do
|
||||
cbDisplayFormat.Items.Add(GetEnumName(TypeInfo(TJvValidateEditDisplayFormat), Ord(df)));
|
||||
cbDisplayFormat.ItemIndex := ord(dfFloat);
|
||||
cbDisplayFormatChange(Self);
|
||||
|
||||
for cp := Low(TJvValidateEditCriticalPointsCheck) to High(TJvValidateEditCriticalPointsCheck) do
|
||||
cbCPCheckPoints.Items.Add(GetEnumName(TypeInfo(TJvValidateEditCriticalPointsCheck), Ord(cp)));
|
||||
cbCPCheckPoints.ItemIndex := 0;
|
||||
|
||||
edCPMaxValue.Text := FloatToStr(JvValidateEdit.CriticalPoints.MaxValue);
|
||||
edCPMinValue.Text := FloatToStr(JvValidateEdit.CriticalPoints.MinValue);
|
||||
|
||||
colCPAbove.Selected := JvValidateEdit.CriticalPoints.ColorAbove;
|
||||
colCPBelow.Selected := JvValidateEdit.CriticalPoints.ColorBelow;
|
||||
colCPAbove.OnChange := @colCPAboveChange;
|
||||
colCPBelow.OnChange := @colCPBelowChange;
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.btnSetToPIClick(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.AsFloat := pi;
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.cbDisplayFormatKeyPress(Sender: TObject; var Key: Char);
|
||||
begin
|
||||
if Key = #13 then
|
||||
cbDisplayFormatChange(Sender);
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.cbDisplayFormatChange(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.DisplayFormat := TJvValidateEditDisplayFormat(cbDisplayFormat.ItemIndex);
|
||||
edCheckChars.Text := JvValidateEdit.CheckChars;
|
||||
btnCheckChars.Enabled := (cbDisplayFormat.Text = 'dfCheckChars') or (cbDisplayFormat.Text = 'dfNonCheckChars');
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.seDecimalPlacesChange(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.DecimalPlaces := seDecimalPlaces.Value;
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.chkHasMaxValueClick(Sender: TObject);
|
||||
begin
|
||||
// NOTE: StrToFloatDefIgnoreInvalidCharacters now called JvSafeStrToFloatDef:
|
||||
JvValidateEdit.MaxValue := StrToFloatDef(edMaxValue.Text, 0);
|
||||
JvValidateEdit.HasMaxValue := chkHasMaxValue.Checked;
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.chkHasMinValueClick(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.MinValue := StrToFloatDef(edMinValue.Text, 0);
|
||||
JvValidateEdit.HasMinValue := chkHasMinValue.Checked;
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.btnSetToClick(Sender: TObject);
|
||||
begin
|
||||
case rgSetToType.ItemIndex of
|
||||
0:
|
||||
if chkAsVariant.Checked then
|
||||
JvValidateEdit.Value := StrToCurrDef(edSetTo.Text, 0)
|
||||
else
|
||||
JvValidateEdit.AsCurrency := StrToCurrDef(edSetTo.Text, 0);
|
||||
1:
|
||||
if chkAsVariant.Checked then
|
||||
JvValidateEdit.Value := StrToFloatDef(edSetTo.Text, 0)
|
||||
else
|
||||
JvValidateEdit.AsFloat := StrToFloatDef(edSetTo.Text, 0);
|
||||
2:
|
||||
if chkAsVariant.Checked then
|
||||
JvValidateEdit.Value := StrToIntDef(edSetTo.Text, 0)
|
||||
else
|
||||
JvValidateEdit.AsInteger := StrToIntDef(edSetTo.Text, 0);
|
||||
3:
|
||||
if chkAsVariant.Checked then
|
||||
JvValidateEdit.Value := edSetTo.Text
|
||||
else
|
||||
JvValidateEdit.Text := edSetTo.Text;
|
||||
end;
|
||||
edSetTo.SetFocus;
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.chkZeroEmptyClick(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.ZeroEmpty := chkZeroEmpty.Checked;
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.btnCheckCharsClick(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.CheckChars := edCheckChars.Text;
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.btnSetDisplayPrefixClick(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.DisplayPrefix := edDisplayPrefix.Text;
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.btnSetDisplaySuffixClick(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.DisplaySuffix := edDisplaySuffix.Text;
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.edCPMaxValueExit(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.CriticalPoints.MaxValue := StrToFloatDef(edCPMaxValue.Text, 0);
|
||||
edCPMaxValue.Text := FloatToStr(JvValidateEdit.CriticalPoints.MaxValue);
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.edCPMinValueExit(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.CriticalPoints.MinValue := StrToFloatDef(edCPMinValue.Text, 0);
|
||||
edCPMinValue.Text := FloatToStr(JvValidateEdit.CriticalPoints.MinValue);
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.colCPAboveChange(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.CriticalPoints.ColorAbove := colCpAbove.Selected;
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.colCPBelowChange(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.CriticalPoints.ColorBelow := colCpBelow.Selected;
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.cbCPCheckPointsChange(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.CriticalPoints.CheckPoints :=
|
||||
TJvValidateEditCriticalPointsCheck(cbCPCheckPoints.ItemIndex);
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmValidateEditDemo.edMaxValueExit(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.MaxValue := StrToFloatDef(edMaxValue.Text, 0);
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.edMinValueExit(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.MinValue := StrToFloatDef(edMinValue.Text, 0);
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.JvValidateEditCustomValidate(
|
||||
Sender: TObject; Key: Char; const AText: String; const Pos: Integer;
|
||||
var IsValid: Boolean);
|
||||
|
||||
function KeyOrAscii(Key: Char): string;
|
||||
begin
|
||||
if Key < #32 then
|
||||
Result := Format('#%s', [Key])
|
||||
else
|
||||
Result := Key;
|
||||
end;
|
||||
|
||||
begin
|
||||
IsValid := MessageDlg(Format('Accept this key: %s?', [KeyOrAscii(Key)]), mtConfirmation, [mbYes, mbNo], 0) = mrYes;
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.JvValidateEditValueChanged(Sender: TObject);
|
||||
begin
|
||||
if chkValueChanged.Checked then
|
||||
MessageDlg('ValidateEdit Text changed to: ' + JvValidateEdit.Text,
|
||||
mtInformation, [mbOK], 0);
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.chkMaxValueIncludedClick(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.CriticalPoints.MaxValueIncluded := chkMaxValueIncluded.Checked;
|
||||
end;
|
||||
|
||||
procedure TfrmValidateEditDemo.chkMinValueIncludedClick(Sender: TObject);
|
||||
begin
|
||||
JvValidateEdit.CriticalPoints.MinValueIncluded := chkMinValueIncluded.Checked;
|
||||
end;
|
||||
|
||||
end.
|
87
components/jvcllaz/examples/JvValidateEdit/Notes.txt
Normal file
87
components/jvcllaz/examples/JvValidateEdit/Notes.txt
Normal file
@ -0,0 +1,87 @@
|
||||
TJvValidateEdit
|
||||
|
||||
unit = JvValidateEdit
|
||||
|
||||
inherits from TJvCustomEdit
|
||||
|
||||
Introduced behaviour:
|
||||
=====================
|
||||
|
||||
Properties:
|
||||
===========
|
||||
|
||||
[Public]
|
||||
|
||||
AsCurrency: Currency
|
||||
The value as an Currency
|
||||
|
||||
AsFloat: Integer
|
||||
The value as an Double
|
||||
|
||||
AsInteger: Integer
|
||||
The value as an integer
|
||||
|
||||
[Published]
|
||||
|
||||
CheckChars: string
|
||||
The characters that are allowed to be entered (or in the case of dfNonCheckChars, *not* allowed)
|
||||
True numeric types (dfCurrency, dfFloat, dfInteger, dfPercent, dfScientific and dfYear) are allowed to have a leading + or - as well.
|
||||
Changing CheckChars triggers a re-Validation of the Text.
|
||||
|
||||
CriticalPoints: TCriticalPoints
|
||||
Critical points only work for the numeric DisplayFormat styles. Unlike MaxValue and MinValue, you can exceed a CriticalPoint, but it will apply a colour to the value when it falls outside the range specified. CriticalPoints.MinValue and CriticalPoints.MaxValue define the range in which the Value has the original colour set for the Font. If the Value falls below CriticalPoints.MinValue, the Value gets the colour CriticalPoints.ColorBelow and if the Value goes above CriticalPoints.MaxValue, the Value gets the colour CriticalPoints.ColorAbove. CriticalPoints.CheckPoints defines how many points are checked, and may have the values cpNone, cpMax or cpBoth. cpNone is the default and means no colouring is done; cpMaxValue means that only the MaxValue is checked; cpBoth mean both the MaxValue and the MinValue are checked.
|
||||
|
||||
DecimalPlaces: Cardinal
|
||||
For numeric types that support decimals (dfCurrency, dfFloat, dfPercent, and dfScientific), the number of decimals displayed. The actual edit value will be rounded to this number of decimal places if a greater precision is entered.
|
||||
dfCurrency may only have up to 4 decimals.
|
||||
|
||||
DisplayFormat: enumerated type
|
||||
dfAlphabetic, dfAlphaNumeric, dfBinary, dfCheckChars, dfCurrency, dfCustom, dfFloat, dfHex, dfInteger, dfNonCheckChars, dfNone, dfOctal, dfPercent, dfScientific, dfYear
|
||||
Controls the key that can be entered, and how the display is formatted.
|
||||
Modifies CheckChars to the appropriate characters to check.
|
||||
Changing DisplayFormat triggers a re-Validation of the Text.
|
||||
|
||||
DisplayPrefix: string
|
||||
A string that will be prepended to the displayed value. For example, to show Australian currency you would set the DisplayFormat to dfCurrency and the DisplayPrefix to 'AU' so a Value of 10 would display 'AU$10.00'
|
||||
|
||||
DisplaySuffix: string
|
||||
A string that will be appended to the displayed value.
|
||||
|
||||
EditText: string
|
||||
The text as entered (unformatted)
|
||||
|
||||
HasMaxValue: boolean
|
||||
Specifies whether the property MaxValue is to be checked to ensure the value entered is within the range.
|
||||
|
||||
HasMinValue
|
||||
Specifies whether the property MinValue is to be checked to ensure the value entered is within the range.
|
||||
|
||||
MaxValue: Double
|
||||
The maximum value the entered value can have
|
||||
|
||||
MinValue: Double
|
||||
The minimum value the entered value can have
|
||||
|
||||
Text: string
|
||||
The formatted text
|
||||
|
||||
Value: Variant
|
||||
The value of the entered value. The type will vary depending on DisplayFormat
|
||||
|
||||
ZeroEmpty: Boolean
|
||||
Whether to display an empty edit box when the value is 0
|
||||
|
||||
Events:
|
||||
=======
|
||||
|
||||
OnCustomValidate(Sender: TObject; Key: Char; const AText: string; var IsValid: boolean)
|
||||
Called on each keystroke when the DisplayFormat is dfCustom so the user can validate the characters
|
||||
|
||||
OnValueChanged(Sender: TObject)
|
||||
Triggers when the value is changed, either by an assignment of a value or on exit from the field if the value of the field as been edited
|
||||
|
||||
Problems:
|
||||
=========
|
||||
|
||||
TJvValidateFormat uses the SysUtils.Format function to format numeric values. While this uses the Windows regional settings for the currency symbol, decimal separator and thousands separator, it does not format using the negative symbol, negative number format, negative currency format and positive currency format. This could be rectified by a custom written formatting routine.
|
||||
|
90
components/jvcllaz/examples/JvValidateEdit/readme.txt
Normal file
90
components/jvcllaz/examples/JvValidateEdit/readme.txt
Normal file
@ -0,0 +1,90 @@
|
||||
TJvValidateEdit
|
||||
|
||||
unit = JvValidateEdit
|
||||
|
||||
inherits from TJvCustomEdit
|
||||
|
||||
Introduced behaviour:
|
||||
=====================
|
||||
|
||||
Properties:
|
||||
===========
|
||||
|
||||
[Public]
|
||||
|
||||
AsCurrency: Currency
|
||||
The value as a Currency
|
||||
|
||||
AsFloat: Double
|
||||
The value as a Double
|
||||
|
||||
AsInteger: Integer
|
||||
The value as an integer
|
||||
|
||||
[Published]
|
||||
|
||||
AutoAlignment: boolean
|
||||
When True, the Alignment is automatically assigned to taRightJustify for numbers and taLeftJustify for text when the DisplayFormat changes.
|
||||
|
||||
CheckChars: string
|
||||
The characters that are allowed to be entered (or in the case of dfNonCheckChars, *not* allowed)
|
||||
True numeric types (dfCurrency, dfFloat, dfInteger, dfPercent, dfScientific and dfYear) are allowed to have a leading + or - as well.
|
||||
Changing CheckChars triggers a re-Validation of the Text.
|
||||
|
||||
CriticalPoints: TCriticalPoints
|
||||
Critical points only work for the numeric DisplayFormat styles. Unlike MaxValue and MinValue, you can exceed a CriticalPoint, but it will apply a colour to the value when it falls outside the range specified. CriticalPoints.MinValue and CriticalPoints.MaxValue define the range in which the Value has the original colour set for the Font. If the Value falls below CriticalPoints.MinValue, the Value gets the colour CriticalPoints.ColorBelow and if the Value goes above CriticalPoints.MaxValue, the Value gets the colour CriticalPoints.ColorAbove. CriticalPoints.CheckPoints defines how many points are checked, and may have the values cpNone, cpMax or cpBoth. cpNone is the default and means no colouring is done; cpMaxValue means that only the MaxValue is checked; cpBoth mean both the MaxValue and the MinValue are checked.
|
||||
|
||||
DecimalPlaces: Cardinal
|
||||
For numeric types that support decimals (dfCurrency, dfFloat, dfPercent, and dfScientific), the number of decimals displayed. The actual edit value will be rounded to this number of decimal places if a greater precision is entered.
|
||||
dfCurrency may only have up to 4 decimals.
|
||||
|
||||
DisplayFormat: enumerated type
|
||||
dfAlphabetic, dfAlphaNumeric, dfBinary, dfCheckChars, dfCurrency, dfCustom, dfFloat, dfHex, dfInteger, dfNonCheckChars, dfNone, dfOctal, dfPercent, dfScientific, dfYear
|
||||
Controls the keys that can be entered, and how the display is formatted.
|
||||
Modifies CheckChars to the appropriate characters to check.
|
||||
Changing DisplayFormat triggers a re-Validation of the Text.
|
||||
|
||||
DisplayPrefix: string
|
||||
A string that will be prepended to the displayed value. For example, to show Australian currency you would set the DisplayFormat to dfCurrency and the DisplayPrefix to 'AU' so a Value of 10 would display 'AU$10.00'
|
||||
|
||||
DisplaySuffix: string
|
||||
A string that will be appended to the displayed value.
|
||||
|
||||
EditText: string
|
||||
The text as entered (unformatted)
|
||||
|
||||
HasMaxValue: boolean
|
||||
Specifies whether the property MaxValue is to be checked to ensure the value entered is within the range.
|
||||
|
||||
HasMinValue
|
||||
Specifies whether the property MinValue is to be checked to ensure the value entered is within the range.
|
||||
|
||||
MaxValue: Double
|
||||
The maximum value the entered value can have
|
||||
|
||||
MinValue: Double
|
||||
The minimum value the entered value can have
|
||||
|
||||
Text: string
|
||||
The formatted text
|
||||
|
||||
Value: Variant
|
||||
The value of the entered value. The type will vary depending on DisplayFormat
|
||||
|
||||
ZeroEmpty: Boolean
|
||||
Whether to display an empty edit box when the value is 0
|
||||
|
||||
Events:
|
||||
=======
|
||||
|
||||
OnCustomValidate(Sender: TObject; Key: Char; const AText: string; var IsValid: boolean)
|
||||
Called on each keystroke when the DisplayFormat is dfCustom so the user can validate the characters
|
||||
|
||||
OnValueChanged(Sender: TObject)
|
||||
Triggers when the value is changed, either by an assignment of a value or on exit from the field if the value of the field as been edited
|
||||
|
||||
Problems:
|
||||
=========
|
||||
|
||||
TJvValidateFormat uses the SysUtils.Format function to format numeric values. While this uses the Windows regional settings for the currency symbol, decimal separator and thousands separator, it does not format using the negative symbol, negative number format, negative currency format and positive currency format. This could be rectified by a custom written formatting routine.
|
||||
|
Loading…
Reference in New Issue
Block a user