From f1b3d0ca111832c837287f94f0ca3756efe0736b Mon Sep 17 00:00:00 2001 From: Ondrej Pokorny Date: Wed, 30 Nov 2022 10:14:56 +0100 Subject: [PATCH] Revert "lcl: label: change left when making label visible for right-aligned autosized label. issue #21898" This reverts commit 369b6b255e2c49104bab63ca5596836055c67b90. --- lcl/include/customlabel.inc | 23 ----------------------- lcl/stdctrls.pp | 1 - 2 files changed, 24 deletions(-) diff --git a/lcl/include/customlabel.inc b/lcl/include/customlabel.inc index 6d5ad9f9fd..f24f03ee7f 100644 --- a/lcl/include/customlabel.inc +++ b/lcl/include/customlabel.inc @@ -262,29 +262,6 @@ begin Invalidate; end; -procedure TCustomLabel.SetVisible(Value: Boolean); -var - OldWidth, OldLeft: Integer; -begin - // when changing to Visible, the width gets updated, check for right aligment and change left just like it is done in UpdateSize - // see issue #21898 - if Value and not Visible then - begin - OldWidth := Width; - OldLeft := Left; - end else - begin - OldWidth := -1; - OldLeft := -1; - end; - - inherited SetVisible(Value); - - if (OldWidth>=0) and (AutoSize or OptimalFill) and (Alignment=taRightJustify) - and (OldWidth<>Width) and (OldLeft=Left) then - Left := Left-Width+OldWidth; -end; - {------------------------------------------------------------------------------ Method: TCustomLabel.SetWordWrap Params: None diff --git a/lcl/stdctrls.pp b/lcl/stdctrls.pp index f9722239cb..ffcaa5505d 100644 --- a/lcl/stdctrls.pp +++ b/lcl/stdctrls.pp @@ -1598,7 +1598,6 @@ type procedure SetWordWrap(Value: Boolean); procedure Loaded; override; procedure UpdateSize; - procedure SetVisible(Value: Boolean); override; property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify; property FocusControl: TWinControl read FFocusControl write SetFocusControl;