Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder Components » View Thread |
Messages 1 to 1 of 1 total |
Extending TEdit to implement validation base on RegEx |
Mon, Jun 17 2019 1:42 PM | Permanent Link |
Mario Enríquez Open Consult | Hi Folks,
I need to extend TEdit to include some properties and a method to support input validation base on RegEx. The idea is to have a Validation string property where one can enter a RegEx expression to validate the value on the Text property and a method that returns True/False whatever the Text property pass the validation or not. This is the basic functionality that I expect to achieve, and plan to extend it to a more robust validation schema where on can ask the parent/owner to check for validation of all its members before submiting a form. The thing is, I'm stuck in the implementation.. For some reason, when the Text property is assigned that Text property in the Embbed TEdit is not getting updated. Any idea or recommendations? I've extentd TEdit the following way: {$INTERFACE TmkEdit} TmkEdit = class(TEdit) private { Private declarations } FValidationExpStr: string; FIsRequired: boolean; FEdit : TEdit; // function GetInputType // procedure SetInputType default tiNone protected { Protected declarations } function DoGetText: String; override; procedure DoSetText(const Value: String); override; public { Public declarations } constructor Create(AOwner: TComponent); override; function isValid: boolean; published { Published declarations } property Top; property Left; property Height; property Width; property Alignment; property AlwaysOnTop; property Animations; property AutoComplete; property Constraints; property Cursor; property DataColumn; property DataSet; property Direction; property DisplayOrder; property Enabled; property Font; property Hint; // property InputType: TTextInputType read GetInputType write SetInputType default tiNone // description 'Specifies the input type (useful for mobile so that the proper keyboard is shown)'; property Layout; property LayoutOrder; property Margins; property MaxLength; property ReadOnly; property SpellCheck; property TabOrder; property TabStop default True; property Tag; property Text: string read DoGetText write DoSetText; property Visible; property ValidationExpression: string read FValidationExpStr write FValidationExpStr; property IsRequired: boolean read FIsRequired write FIsRequired; property OnAnimationComplete; property OnAnimationsComplete; property OnShow; property OnHide; property OnMove; property OnSize; property OnClick; property OnDblClick; property OnMouseDown; property OnMouseMove; property OnMouseUp; property OnMouseEnter; property OnMouseLeave; property OnTouchStart; property OnTouchMove; property OnTouchEnd; property OnTouchCancel; property OnEnter; property OnExit; property OnKeyDown; property OnKeyPress; property OnKeyUp; property OnChange; end; implementation {$IFDEF DESIGN} uses WebForms, WebDesign; {$ELSE} uses WebForms, WebDOM; {$ENDIF} constructor TmkEdit.Create(AOwner: TComponent); begin inherited Create(AOwner); FEdit := TEdit.Create(Self); FEdit.Top := Top; FEdit.Parent := Self; FEdit.Margins.Bottom := 0; FEdit.Margins.Left := 0; FEdit.Margins.Right := 0; FEdit.Margins.Top := 0; FEdit.LayOut.Position := lpLeft; FEdit.LayOut.Consumption := lcNone; FEdit.LayOut.Overflow := loRight; end; function TmkEdit.DoGetText: String; begin Result := FEdit.Text; end; procedure TmkEdit.DoSetText(const Value: String); begin FEdit.Text := Value; end; |
This web page was last updated on Friday, April 19, 2024 at 07:09 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |