Registriert seit: 12. Aug 2003
Ort: Soest
4.016 Beiträge
Delphi 10.1 Berlin Enterprise
|
AW: DSharp, DevExpress Editors, Bindings
10. Sep 2019, 12:18
Delphi-Quellcode:
type
TcxTextEdit = class(cxTextEdit.TcxTextEdit, INotifyPropertyChanged)
private
FNotifyPropertyChanged: TNotifyPropertyChanged;
property NotifyPropertyChanged: TNotifyPropertyChanged
read FNotifyPropertyChanged implements INotifyPropertyChanged;
procedure WMChar(var Message: TWMChar); message WM_CHAR;
protected
procedure DoTextChanged; override;
procedure CMExit(var Message: TCMExit); message CM_EXIT;
public
constructor Create(AOwner: TComponent); override;
end;
procedure TcxTextEdit.CMExit(var Message: TCMExit);
begin
try
FNotifyPropertyChanged.NotifyOfPropertyChange('Text', utLostFocus);
inherited;
except
on EValidationError do
begin
SetFocus;
end;
end;
end;
constructor TcxTextEdit.Create(AOwner: TComponent);
begin
inherited;
FNotifyPropertyChanged := TNotifyPropertyChanged.Create(Self);
end;
procedure TcxTextEdit.DoTextChanged;
begin
inherited;
FNotifyPropertyChanged.NotifyOfPropertyChange('Text');
end;
procedure TcxTextEdit.WMChar(var Message: TWMChar);
begin
inherited;
if Message.CharCode = VK_RETURN then
begin
FNotifyPropertyChanged.NotifyOfPropertyChange('Text', utExplicit);
end;
end;
|
|
Zitat
|