Registriert seit: 11. Mai 2005
Ort: Göppingen
1.238 Beiträge
Delphi 2007 Professional
|
Re: Validedit-Komponente
25. Jun 2006, 14:22
Also folgendes muss raus / fand D3 nicht:
MaskUtils
property Anchors;
property BevelEdges;
property BevelInner;
property BevelOuter;
property BevelKind;
property BevelWidth;
property BiDiMode;
property Constraints;
property DragKind;
property ParentBiDiMode;
property OnEndDock;
property OnStartDock;
und dann installiert er es. also wenn das ganze zeug da oben weg ist.sieht jetzt so aus:
Delphi-Quellcode:
unit validEditU;
{$R-,T-,H+,X+}
interface
uses Windows, SysUtils, Classes, StdCtrls, Controls, Messages,
Forms, Graphics, Menus;
TYPE
TOnValidate = function (value:TCaption):boolean of object;
TOnInvalidate = procedure (value:TCaption) of object;
TCustomValidEdit = Class(TCustomEdit)
private
fonValidate : TOnValidate;
fonInvalidate : TOnInvalidate;
procedure CMExit( var Message: TCMExit); message CM_EXIT;
PROTECTED
procedure ValidateEdit;
procedure KeyPress( var Key: Char); override;
PUBLIC
constructor Create(AOwner: TComponent); override;
PUBLISHED
Property onValidate : TOnValidate read fonValidate write fonValidate;
Property OnValidateError : TOnInvalidate read fonInvalidate write fonInvalidate;
end;
{ TMaskEdit }
TValidEdit = class(TCustomValidEdit)
published
property Align;
property AutoSelect;
property AutoSize;
property BorderStyle;
property CharCase;
property Color;
property Ctl3D;
property DragCursor;
property DragMode;
property Enabled;
property Font;
property ImeMode;
property ImeName;
property MaxLength;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PasswordChar;
property PopupMenu;
property ReadOnly;
property ShowHint;
property TabOrder;
property TabStop;
property Text;
property Visible;
property OnChange;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
end;
procedure Register;
implementation
procedure Register;
begin
registerComponents(' Standard',[TValidEdit]);
end;
{ TCustomValidEdit }
procedure TCustomValidEdit.CMExit( var Message: TCMExit);
begin
if not (csDesigning in ComponentState) then
ValidateEdit;
inherited;
end;
constructor TCustomValidEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
fonValidate := NIL;
fonInvalidate := NIL;
end;
procedure TCustomValidEdit.KeyPress( var Key: Char);
begin
inherited KeyPress(Key);
if (Word(Key) = VK_RETURN) then
begin
ValidateEdit;
Exit;
end;
end;
procedure TCustomValidEdit.ValidateEdit;
begin
if (assigned(fonValidate)) then
begin
if not fOnValidate(self.text) then
begin
fonInvalidate(text);
setfocus;
SelectAll;
end;
end;
end;
end.
Mfg
Tobi
Tobias It's not a bug, it's a feature.
|
|
Zitat
|