mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 23:19:31 +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);
|
SetInitialBounds(0, 0, CX, CY);
|
||||||
FShowAccelChar := True;
|
FShowAccelChar := True;
|
||||||
FInternalSetBounds := False;
|
FInternalSetBounds := False;
|
||||||
Color := clNone;
|
|
||||||
AutoSize := True;
|
AutoSize := True;
|
||||||
// Accessibility
|
// Accessibility
|
||||||
AccessibleRole := larLabel;
|
AccessibleRole := larLabel;
|
||||||
@ -234,18 +233,7 @@ end;
|
|||||||
|
|
||||||
function TCustomLabel.GetTransparent: boolean;
|
function TCustomLabel.GetTransparent: boolean;
|
||||||
begin
|
begin
|
||||||
Result := Color = clNone;
|
Result := not(csOpaque in ControlStyle);
|
||||||
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];
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -268,10 +256,10 @@ begin
|
|||||||
if Transparent = NewTransparent then
|
if Transparent = NewTransparent then
|
||||||
exit;
|
exit;
|
||||||
if NewTransparent then
|
if NewTransparent then
|
||||||
Color := clNone
|
ControlStyle := ControlStyle - [csOpaque]
|
||||||
else
|
else
|
||||||
if Color = clNone then
|
ControlStyle := ControlStyle + [csOpaque];
|
||||||
Color := clBackground;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
@ -1586,7 +1586,6 @@ type
|
|||||||
|
|
||||||
function GetLabelText: string; virtual;
|
function GetLabelText: string; virtual;
|
||||||
function GetTransparent: boolean;
|
function GetTransparent: boolean;
|
||||||
procedure SetColor(NewColor: TColor); override;
|
|
||||||
procedure SetFocusControl(Value: TWinControl);
|
procedure SetFocusControl(Value: TWinControl);
|
||||||
procedure SetLayout(Value: TTextLayout);
|
procedure SetLayout(Value: TTextLayout);
|
||||||
procedure SetShowAccelChar(Value: Boolean);
|
procedure SetShowAccelChar(Value: Boolean);
|
||||||
@ -1612,7 +1611,7 @@ type
|
|||||||
procedure Paint; override;
|
procedure Paint; override;
|
||||||
procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); override;
|
procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); override;
|
||||||
property AutoSize default True;
|
property AutoSize default True;
|
||||||
property Color default clNone;
|
property Color default clDefault;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user