mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 05:58:15 +02:00
lcl TLabel: unbind Color and Transparent to fix ParentColor issues
This commit is contained in:
parent
4d12a06af5
commit
4ffce1ec8f
@ -226,7 +226,6 @@ begin
|
||||
SetInitialBounds(0, 0, CX, CY);
|
||||
FShowAccelChar := True;
|
||||
FInternalSetBounds := False;
|
||||
Color := clNone;
|
||||
AutoSize := True;
|
||||
// Accessibility
|
||||
AccessibleRole := larLabel;
|
||||
@ -234,18 +233,7 @@ end;
|
||||
|
||||
function TCustomLabel.GetTransparent: boolean;
|
||||
begin
|
||||
Result := Color = clNone;
|
||||
end;
|
||||
|
||||
procedure TCustomLabel.SetColor(NewColor: TColor);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
// if color = clnone then transparent, so not opaque
|
||||
if NewColor = clNone then
|
||||
ControlStyle := ControlStyle - [csOpaque]
|
||||
else
|
||||
ControlStyle := ControlStyle + [csOpaque];
|
||||
Result := not(csOpaque in ControlStyle);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -268,10 +256,10 @@ begin
|
||||
if Transparent = NewTransparent then
|
||||
exit;
|
||||
if NewTransparent then
|
||||
Color := clNone
|
||||
ControlStyle := ControlStyle - [csOpaque]
|
||||
else
|
||||
if Color = clNone then
|
||||
Color := clBackground;
|
||||
ControlStyle := ControlStyle + [csOpaque];
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -1586,7 +1586,6 @@ type
|
||||
|
||||
function GetLabelText: string; virtual;
|
||||
function GetTransparent: boolean;
|
||||
procedure SetColor(NewColor: TColor); override;
|
||||
procedure SetFocusControl(Value: TWinControl);
|
||||
procedure SetLayout(Value: TTextLayout);
|
||||
procedure SetShowAccelChar(Value: Boolean);
|
||||
@ -1612,7 +1611,7 @@ type
|
||||
procedure Paint; override;
|
||||
procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); override;
|
||||
property AutoSize default True;
|
||||
property Color default clNone;
|
||||
property Color default clDefault;
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user