Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Commit

Permalink
Changed default color value to White
Browse files Browse the repository at this point in the history
  • Loading branch information
DelphiWorlds committed Jan 9, 2018
1 parent 74b852b commit 6c22d8c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Controls/DW.RichEdit.Win.pas
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ TWinNativeRichEdit = class(TWinNativeMemo)
private
FConverter: TConversion;
FModel: TCustomRichEditModel;
procedure ColorChanged;
function GetRichEdit: TCustomRichEdit;
procedure LoadFromStream(const AStream: TStream; AEncoding: TEncoding);
procedure LoadFromStreamHandler(Sender: TObject; const AStream: TStream; const AEncoding: TEncoding);
function PlainText: Boolean;
protected
procedure CreateHandle; override;
procedure CreateParams(var Params: TCreateParams); override;
function DefineModelClass: TDataModelClass; override;
procedure PMRichEditColorChanged(var Message: TDispatchMessage); message PM_RICHEDIT_COLOR_CHANGED;
Expand Down Expand Up @@ -287,6 +289,12 @@ procedure TWinNativeRichEdit.DefaultHandler(var Message);
inherited DefaultHandler(Message);
end;

procedure TWinNativeRichEdit.CreateHandle;
begin
inherited;
ColorChanged;
end;

procedure TWinNativeRichEdit.CreateParams(var Params: TCreateParams);
const
RichEditClassName = 'RICHEDIT20W';
Expand Down Expand Up @@ -322,6 +330,11 @@ function TWinNativeRichEdit.PlainText: Boolean;
end;

procedure TWinNativeRichEdit.PMRichEditColorChanged(var Message: TDispatchMessage);
begin
ColorChanged;
end;

procedure TWinNativeRichEdit.ColorChanged;
begin
SendMessage(Handle, EM_SETBKGNDCOLOR, 0, TAlphaColors.ColorToRGB(RichEdit.Color));
end;
Expand Down
1 change: 1 addition & 0 deletions Controls/DW.RichEdit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ procedure TCustomRichEditModel.LoadFromStream(const AStream: TStream; const AEnc

constructor TCustomRichEdit.Create(AOwner: TComponent);
begin
FColor := TAlphaColors.White;
inherited;
ControlType := TControlType.Platform;
end;
Expand Down

0 comments on commit 6c22d8c

Please sign in to comment.