Skip to content

Commit

Permalink
fix: TRegExEdit style hook issue
Browse files Browse the repository at this point in the history
  • Loading branch information
errorsoft committed Apr 4, 2023
1 parent e2319b3 commit 14655b2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Source/ES.RegExControls.pas
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ TEsRegexEdit = class(TEdit, IRegexIndicator)
// TEdit style hook
TEsRegexEditStyleHook = class(TEditStyleHook)
strict protected
{$IFNDEF VER350UP}
procedure PaintBackground(Canvas: TCanvas); override;
{$ENDIF}
{$IFDEF VER350UP}
procedure WndProc(var Message: TMessage); override;
{$ENDIF}
end;

// TButtonedEdit
Expand Down Expand Up @@ -533,11 +538,31 @@ procedure TEsRegexEdit.SetColorInvalid(const Value: TColor);

{ TEsRegExEditStyleHook }

{$IFNDEF VER350UP}
procedure TEsRegexEditStyleHook.PaintBackground(Canvas: TCanvas);
begin
Brush.Color := Control.Brush.Color;
inherited;
end;
{$ENDIF}

{$IFDEF VER350UP}
procedure TEsRegexEditStyleHook.WndProc(var Message: TMessage);
begin
case Message.Msg of
CN_CTLCOLORMSGBOX..CN_CTLCOLORSTATIC:
begin
inherited WndProc(Message);
Brush.Color := Control.Brush.Color;
SetBkColor(Message.WParam, ColorToRGB(Brush.Color));
Message.Result := LRESULT(Brush.Handle);
Handled := True;
end;
else
inherited WndProc(Message);
end;
end;
{$ENDIF}

{ TEsRegExButtonedEdit }

Expand Down

0 comments on commit 14655b2

Please sign in to comment.