You've already forked lazarus-ccr
jvcllaz: Adjust layout of validators demo to Linux. Less hints and warnings.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6941 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -12,7 +12,7 @@ procedure Register;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$R ..\..\resource\JvValidatorsReg.res}
|
{$R ..\..\resource\jvvalidatorsreg.res}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
JvDsgnConsts, JvValidators, JvErrorIndicator, JvValidatorsEditorForm;
|
JvDsgnConsts, JvValidators, JvErrorIndicator, JvValidatorsEditorForm;
|
||||||
|
@ -412,7 +412,7 @@ end;
|
|||||||
procedure TfrmValidatorsEditor.DoAddNewValidator(Sender: TObject);
|
procedure TfrmValidatorsEditor.DoAddNewValidator(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
with Sender as TAction do
|
with Sender as TAction do
|
||||||
AddNew(TJvBaseValidatorClass(Tag));
|
AddNew({%H-}TJvBaseValidatorClass(Tag));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -438,7 +438,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
A := TAction.Create(Self);
|
A := TAction.Create(Self);
|
||||||
A.Caption := AName;
|
A.Caption := AName;
|
||||||
A.Tag := NativeInt(AClass);
|
A.Tag := {%H-}PtrInt(AClass);
|
||||||
A.ImageIndex := 0;
|
A.ImageIndex := 0;
|
||||||
if I - K < 9 then
|
if I - K < 9 then
|
||||||
A.ShortCut := ShortCut(Ord('0') + I + 1 - K, [ssCtrl]);
|
A.ShortCut := ShortCut(Ord('0') + I + 1 - K, [ssCtrl]);
|
||||||
|
@ -1,24 +1,20 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="10"/>
|
<Version Value="12"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
<Flags>
|
||||||
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||||
<MainUnitHasCreateFormStatements Value="False"/>
|
<MainUnitHasCreateFormStatements Value="False"/>
|
||||||
<MainUnitHasTitleStatement Value="False"/>
|
<MainUnitHasTitleStatement Value="False"/>
|
||||||
|
<CompatibilityMode Value="True"/>
|
||||||
</Flags>
|
</Flags>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<MainUnit Value="0"/>
|
|
||||||
<Title Value="JvValidatorsDemo"/>
|
<Title Value="JvValidatorsDemo"/>
|
||||||
<UseAppBundle Value="False"/>
|
<UseAppBundle Value="False"/>
|
||||||
<ResourceType Value="res"/>
|
<ResourceType Value="res"/>
|
||||||
<UseXPManifest Value="True"/>
|
<UseXPManifest Value="True"/>
|
||||||
<XPManifest>
|
|
||||||
<TextName Value="CompanyName.ProductName.AppName"/>
|
|
||||||
<TextDesc Value="Your application description."/>
|
|
||||||
</XPManifest>
|
|
||||||
</General>
|
</General>
|
||||||
<i18n>
|
<i18n>
|
||||||
<EnableI18N LFM="False"/>
|
<EnableI18N LFM="False"/>
|
||||||
@ -30,9 +26,10 @@
|
|||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
</PublishOptions>
|
</PublishOptions>
|
||||||
<RunParams>
|
<RunParams>
|
||||||
<local>
|
<FormatVersion Value="2"/>
|
||||||
<FormatVersion Value="1"/>
|
<Modes Count="1">
|
||||||
</local>
|
<Mode0 Name="default"/>
|
||||||
|
</Modes>
|
||||||
</RunParams>
|
</RunParams>
|
||||||
<RequiredPackages Count="2">
|
<RequiredPackages Count="2">
|
||||||
<Item1>
|
<Item1>
|
||||||
|
@ -1,133 +1,197 @@
|
|||||||
object frmMain: TfrmMain
|
object frmMain: TfrmMain
|
||||||
Left = 306
|
Left = 306
|
||||||
Height = 274
|
Height = 270
|
||||||
Top = 126
|
Top = 126
|
||||||
Width = 619
|
Width = 519
|
||||||
|
AutoSize = True
|
||||||
Caption = 'JvValidators demo'
|
Caption = 'JvValidators demo'
|
||||||
ClientHeight = 274
|
ClientHeight = 270
|
||||||
ClientWidth = 619
|
ClientWidth = 519
|
||||||
Color = clBtnFace
|
Color = clBtnFace
|
||||||
Constraints.MinHeight = 270
|
|
||||||
Constraints.MinWidth = 560
|
|
||||||
DefaultMonitor = dmDesktop
|
DefaultMonitor = dmDesktop
|
||||||
Font.Color = clWindowText
|
Font.Color = clWindowText
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
|
OnShow = FormShow
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '1.7'
|
LCLVersion = '2.1.0.0'
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
|
AnchorSideLeft.Control = Owner
|
||||||
|
AnchorSideTop.Control = Owner
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 16
|
Top = 16
|
||||||
Width = 167
|
Width = 167
|
||||||
|
BorderSpacing.Left = 16
|
||||||
|
BorderSpacing.Top = 16
|
||||||
Caption = 'This edit must have a(ny) value:'
|
Caption = 'This edit must have a(ny) value:'
|
||||||
FocusControl = edRequired
|
FocusControl = edRequired
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label2: TLabel
|
object Label2: TLabel
|
||||||
|
AnchorSideLeft.Control = Label1
|
||||||
|
AnchorSideTop.Control = edRequired
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 64
|
Top = 66
|
||||||
Width = 233
|
Width = 233
|
||||||
|
BorderSpacing.Top = 8
|
||||||
Caption = 'This edit must have more than 9 characters:'
|
Caption = 'This edit must have more than 9 characters:'
|
||||||
FocusControl = edRequired10Chars
|
FocusControl = edRequired10Chars
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label3: TLabel
|
object Label3: TLabel
|
||||||
|
AnchorSideLeft.Control = Label1
|
||||||
|
AnchorSideTop.Control = edRequired10Chars
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 112
|
Top = 116
|
||||||
Width = 228
|
Width = 228
|
||||||
|
BorderSpacing.Top = 8
|
||||||
Caption = 'This edit must match the reg. expr."A.B.C.":'
|
Caption = 'This edit must match the reg. expr."A.B.C.":'
|
||||||
FocusControl = edRegExpr
|
FocusControl = edRegExpr
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label4: TLabel
|
object Label4: TLabel
|
||||||
|
AnchorSideLeft.Control = Label1
|
||||||
|
AnchorSideTop.Control = edRegExpr
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 160
|
Top = 162
|
||||||
Width = 201
|
Width = 201
|
||||||
|
BorderSpacing.Top = 8
|
||||||
Caption = 'The value must be between 0 and 100:'
|
Caption = 'The value must be between 0 and 100:'
|
||||||
FocusControl = edRange0to100
|
FocusControl = edRange0to100
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object Label5: TLabel
|
object Label5: TLabel
|
||||||
Left = 280
|
AnchorSideLeft.Control = edRequired10Chars
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = Label1
|
||||||
|
Left = 281
|
||||||
Height = 15
|
Height = 15
|
||||||
Top = 16
|
Top = 16
|
||||||
Width = 35
|
Width = 35
|
||||||
|
BorderSpacing.Left = 32
|
||||||
Caption = 'Result:'
|
Caption = 'Result:'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object edRequired: TEdit
|
object edRequired: TEdit
|
||||||
|
AnchorSideLeft.Control = Label1
|
||||||
|
AnchorSideTop.Control = Label1
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = edRequired10Chars
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 32
|
Top = 35
|
||||||
Width = 240
|
Width = 233
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 4
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object edRequired10Chars: TEdit
|
object edRequired10Chars: TEdit
|
||||||
|
AnchorSideLeft.Control = Label1
|
||||||
|
AnchorSideTop.Control = Label2
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = Label2
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 80
|
Top = 85
|
||||||
Width = 240
|
Width = 233
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 4
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object edRegExpr: TEdit
|
object edRegExpr: TEdit
|
||||||
|
AnchorSideLeft.Control = Label1
|
||||||
|
AnchorSideTop.Control = Label3
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = edRequired10Chars
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 128
|
Top = 131
|
||||||
Width = 240
|
Width = 233
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object edRange0to100: TEdit
|
object edRange0to100: TEdit
|
||||||
|
AnchorSideLeft.Control = Label1
|
||||||
|
AnchorSideTop.Control = Label4
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = udRange0to100
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 176
|
Top = 181
|
||||||
Width = 227
|
Width = 212
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Top = 4
|
||||||
|
BorderSpacing.Right = 4
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
Text = '-1'
|
Text = '-1'
|
||||||
end
|
end
|
||||||
object udRange0to100: TUpDown
|
object udRange0to100: TUpDown
|
||||||
Left = 243
|
AnchorSideRight.Control = edRequired10Chars
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 232
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 176
|
Top = 181
|
||||||
Width = 15
|
Width = 17
|
||||||
|
Anchors = [akTop, akRight]
|
||||||
Associate = edRange0to100
|
Associate = edRange0to100
|
||||||
Max = 200
|
Max = 200
|
||||||
Min = -100
|
Min = -100
|
||||||
Position = -1
|
Position = -1
|
||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
Wrap = False
|
|
||||||
end
|
end
|
||||||
object btnCheck: TButton
|
object btnCheck: TButton
|
||||||
Left = 336
|
AnchorSideLeft.Control = btnValSum
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = btnProviderCheck
|
||||||
|
Left = 356
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 224
|
Top = 228
|
||||||
Width = 137
|
Width = 137
|
||||||
Anchors = [akLeft, akBottom]
|
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
|
BorderSpacing.Left = 24
|
||||||
|
BorderSpacing.Right = 16
|
||||||
Caption = 'Use OnValidateFailed'
|
Caption = 'Use OnValidateFailed'
|
||||||
OnClick = btnCheckClick
|
OnClick = btnCheckClick
|
||||||
TabOrder = 7
|
TabOrder = 7
|
||||||
end
|
end
|
||||||
object btnProviderCheck: TButton
|
object btnProviderCheck: TButton
|
||||||
|
AnchorSideLeft.Control = Label1
|
||||||
|
AnchorSideTop.Control = edRange0to100
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 224
|
Top = 228
|
||||||
Width = 130
|
Width = 130
|
||||||
Anchors = [akLeft, akBottom]
|
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
|
BorderSpacing.Top = 24
|
||||||
|
BorderSpacing.Bottom = 16
|
||||||
Caption = 'Use JvErrorIndicator'
|
Caption = 'Use JvErrorIndicator'
|
||||||
OnClick = btnProviderCheckClick
|
OnClick = btnProviderCheckClick
|
||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
end
|
end
|
||||||
object reResults: TMemo
|
object reResults: TMemo
|
||||||
|
AnchorSideLeft.Control = Label5
|
||||||
|
AnchorSideTop.Control = edRequired
|
||||||
|
AnchorSideRight.Control = Owner
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
AnchorSideBottom.Control = edRange0to100
|
||||||
|
AnchorSideBottom.Side = asrBottom
|
||||||
Cursor = crArrow
|
Cursor = crArrow
|
||||||
Left = 280
|
Left = 281
|
||||||
Height = 167
|
Height = 169
|
||||||
Top = 32
|
Top = 35
|
||||||
Width = 326
|
Width = 212
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akBottom]
|
||||||
|
BorderSpacing.Right = 16
|
||||||
Lines.Strings = (
|
Lines.Strings = (
|
||||||
'This is a demo for the JvValidators component as well as the JvErrorProvider and, to some extent, the JvValidationSummary component.'
|
'This is a demo for the JvValidators component as well as the JvErrorProvider and, to some extent, the JvValidationSummary component.'
|
||||||
''
|
''
|
||||||
@ -154,20 +218,23 @@ object frmMain: TfrmMain
|
|||||||
WordWrap = False
|
WordWrap = False
|
||||||
end
|
end
|
||||||
object btnValSum: TButton
|
object btnValSum: TButton
|
||||||
Left = 160
|
AnchorSideLeft.Control = btnProviderCheck
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = btnProviderCheck
|
||||||
|
Left = 170
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 224
|
Top = 228
|
||||||
Width = 162
|
Width = 162
|
||||||
Anchors = [akLeft, akBottom]
|
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
|
BorderSpacing.Left = 24
|
||||||
Caption = 'Use JvValidationSummary'
|
Caption = 'Use JvValidationSummary'
|
||||||
OnClick = btnValSumClick
|
OnClick = btnValSumClick
|
||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
end
|
end
|
||||||
object JvValidators1: TJvValidators
|
object JvValidators1: TJvValidators
|
||||||
OnValidateFailed = JvValidators1ValidateFailed
|
OnValidateFailed = JvValidators1ValidateFailed
|
||||||
left = 258
|
left = 408
|
||||||
top = 104
|
top = 24
|
||||||
object JvRequiredFieldValidator1: TJvRequiredFieldValidator
|
object JvRequiredFieldValidator1: TJvRequiredFieldValidator
|
||||||
ControlToValidate = edRequired
|
ControlToValidate = edRequired
|
||||||
PropertyToValidate = 'Text'
|
PropertyToValidate = 'Text'
|
||||||
@ -197,12 +264,12 @@ object frmMain: TfrmMain
|
|||||||
object JvErrorIndicator1: TJvErrorIndicator
|
object JvErrorIndicator1: TJvErrorIndicator
|
||||||
ImageIndex = 0
|
ImageIndex = 0
|
||||||
DefaultUseAnchors = False
|
DefaultUseAnchors = False
|
||||||
left = 296
|
left = 408
|
||||||
top = 104
|
top = 80
|
||||||
end
|
end
|
||||||
object JvValidationSummary1: TJvValidationSummary
|
object JvValidationSummary1: TJvValidationSummary
|
||||||
OnChange = JvValidationSummary1Change
|
OnChange = JvValidationSummary1Change
|
||||||
left = 328
|
left = 408
|
||||||
top = 104
|
top = 136
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -64,6 +64,7 @@ type
|
|||||||
procedure btnCheckClick(Sender: TObject);
|
procedure btnCheckClick(Sender: TObject);
|
||||||
procedure btnProviderCheckClick(Sender: TObject);
|
procedure btnProviderCheckClick(Sender: TObject);
|
||||||
procedure btnValSumClick(Sender: TObject);
|
procedure btnValSumClick(Sender: TObject);
|
||||||
|
procedure FormShow(Sender: TObject);
|
||||||
procedure reResultsEnter(Sender: TObject);
|
procedure reResultsEnter(Sender: TObject);
|
||||||
procedure JvCustomValidator1Validate(Sender: TObject;
|
procedure JvCustomValidator1Validate(Sender: TObject;
|
||||||
ValueToValidate: Variant; var Valid: Boolean);
|
ValueToValidate: Variant; var Valid: Boolean);
|
||||||
@ -95,6 +96,16 @@ begin
|
|||||||
JvValidators1.ValidationSummary := JvValidationSummary1;
|
JvValidators1.ValidationSummary := JvValidationSummary1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmMain.FormShow(Sender: TObject);
|
||||||
|
begin
|
||||||
|
AutoSize := false;
|
||||||
|
reResults.Anchors := reResults.Anchors + [akRight];;
|
||||||
|
Constraints.MinWidth := Width;
|
||||||
|
Constraints.MinHeight := Height;
|
||||||
|
Width := Width + 100;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TfrmMain.btnCheckClick(Sender: TObject);
|
procedure TfrmMain.btnCheckClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
reResults.Lines.Clear;
|
reResults.Lines.Clear;
|
||||||
@ -162,6 +173,7 @@ begin
|
|||||||
JvErrorIndicator1.Error[BaseValidator.ControlToValidate] := BaseValidator.ErrorMessage;
|
JvErrorIndicator1.Error[BaseValidator.ControlToValidate] := BaseValidator.ErrorMessage;
|
||||||
reResults.Lines.Add(Format('PROVIDER: %s',[BaseValidator.ErrorMessage]));
|
reResults.Lines.Add(Format('PROVIDER: %s',[BaseValidator.ErrorMessage]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmMain.JvValidationSummary1Change(Sender: TObject);
|
procedure TfrmMain.JvValidationSummary1Change(Sender: TObject);
|
||||||
var i:integer;
|
var i:integer;
|
||||||
begin
|
begin
|
||||||
|
@ -96,8 +96,8 @@ type
|
|||||||
// get the number of registered base validator classes
|
// get the number of registered base validator classes
|
||||||
class function BaseValidatorsCount: Integer;
|
class function BaseValidatorsCount: Integer;
|
||||||
// get info on a registered class
|
// get info on a registered class
|
||||||
class procedure GetBaseValidatorInfo(Index: Integer; var DisplayName: string;
|
class procedure GetBaseValidatorInfo(Index: Integer; out DisplayName: string;
|
||||||
var ABaseValidatorClass: TJvBaseValidatorClass);
|
out ABaseValidatorClass: TJvBaseValidatorClass);
|
||||||
|
|
||||||
public
|
public
|
||||||
{$IFDEF JVVALIDATORS_SUPPORTS_DBCONTROLS}
|
{$IFDEF JVVALIDATORS_SUPPORTS_DBCONTROLS}
|
||||||
@ -305,7 +305,7 @@ begin
|
|||||||
Result := GlobalValidatorsList;
|
Result := GlobalValidatorsList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Debug(const Msg: string); overload;
|
procedure Debug(const {%H-}Msg: string); overload;
|
||||||
begin
|
begin
|
||||||
{$IFDEF VALIDATORS_DEBUG}
|
{$IFDEF VALIDATORS_DEBUG}
|
||||||
DebugLn(Msg);
|
DebugLn(Msg);
|
||||||
@ -379,7 +379,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TJvBaseValidator.GetBaseValidatorInfo(Index: Integer;
|
class procedure TJvBaseValidator.GetBaseValidatorInfo(Index: Integer;
|
||||||
var DisplayName: string; var ABaseValidatorClass: TJvBaseValidatorClass);
|
out DisplayName: string; out ABaseValidatorClass: TJvBaseValidatorClass);
|
||||||
begin
|
begin
|
||||||
if (Index < 0) or (Index >= ValidatorsList.Count) then
|
if (Index < 0) or (Index >= ValidatorsList.Count) then
|
||||||
raise Exception.CreateFmt(RsEInvalidIndexd, [Index]);
|
raise Exception.CreateFmt(RsEInvalidIndexd, [Index]);
|
||||||
|
Reference in New Issue
Block a user