D
delhpi
Unregistered / Unconfirmed
GUEST, unregistred user!
unit SafeEdit;interfaceuses { SysUtils,} Classes,{Controls,} StdCtrls,Messages;type TSafeEdit = class(TCustomEdit) private { Private declarations } FRealText: string; procedure SetText(const value: string); protected { Protected declarations } public { Public declarations } procedure WMGETTEXT(var message: TWMGetText); message WM_GETTEXT; published { Published declarations } property Text: string read FRealText write SetText; property PassWordChar; property OnKeyDown; property TabOrder; end;procedure Register;implementationprocedure Register;begin RegisterComponents('Samples', [TSafeEdit]);end;{ TSafeEdit }procedure TSafeEdit.SetText(const value: string);begin if FRealText <> Value then SetTextBuf(PChar(Value));end;procedure TSafeEdit.WMGETTEXT(var message: TWMGetText);begin inherited; FRealText := message.Text; message.Text := ''; message.TextMax := 1; message.Result := 0;end;end.===========procedure TForm1.Button1Click(Sender: TObject);begin showmessage(SafeEdit1.Text);end;