mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-05 13:18:08 +02:00
Anchor Editor: Don't add "SubLabel:TBoundLabel" when using TLabeledEdit. Issue #41314.
This commit is contained in:
parent
1964eee87a
commit
d248079f4e
@ -9,12 +9,12 @@ object AnchorDesigner: TAnchorDesigner
|
|||||||
ClientWidth = 544
|
ClientWidth = 544
|
||||||
Constraints.MinHeight = 361
|
Constraints.MinHeight = 361
|
||||||
Constraints.MinWidth = 544
|
Constraints.MinWidth = 544
|
||||||
|
LCLVersion = '4.99.0.0'
|
||||||
OnActivate = FormActivate
|
OnActivate = FormActivate
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnDeactivate = FormDeactivate
|
OnDeactivate = FormDeactivate
|
||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
LCLVersion = '2.1.0.0'
|
|
||||||
object BorderSpaceGroupBox: TGroupBox
|
object BorderSpaceGroupBox: TGroupBox
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideLeft.Side = asrCenter
|
AnchorSideLeft.Side = asrCenter
|
||||||
|
@ -948,32 +948,29 @@ end;
|
|||||||
procedure TAnchorDesigner.FillComboBoxWithSiblings(AComboBox: TComboBox);
|
procedure TAnchorDesigner.FillComboBoxWithSiblings(AComboBox: TComboBox);
|
||||||
var
|
var
|
||||||
sl: TStringListUTF8Fast;
|
sl: TStringListUTF8Fast;
|
||||||
i: Integer;
|
i, j: Integer;
|
||||||
CurControl: TControl;
|
CurControl, Sibling: TControl;
|
||||||
j: Integer;
|
|
||||||
Sibling: TControl;
|
|
||||||
SelectedControls: TList;
|
SelectedControls: TList;
|
||||||
OldText: String;
|
OldText: String;
|
||||||
Kind: TAnchorKind;
|
Kind: TAnchorKind;
|
||||||
HasSelectedSiblings: Boolean;
|
HasSelSiblings: Boolean;
|
||||||
|
|
||||||
function AddSibling(AControl: TControl): boolean;
|
function AddSiblingSkipSelected(AControl: TControl): boolean;
|
||||||
var
|
// Return True if AControl was selected and thus skipped.
|
||||||
NewControlStr: String;
|
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
if AControl.Name='' then exit;
|
if AControl.Name='' then exit;
|
||||||
if SelectedControls.IndexOf(AControl)>=0 then exit;
|
// Skip selected siblings and return True.
|
||||||
NewControlStr:=ControlToStr(AControl);
|
if SelectedControls.IndexOf(AControl)>=0 then exit(true);
|
||||||
if sl.IndexOf(NewControlStr)>=0 then exit;
|
// This can happen with combined controls like TLabeledEdit.
|
||||||
sl.Add(NewControlStr);
|
if Assigned(AControl.Owner) and (AControl.Owner<>AControl.Parent) then exit;
|
||||||
Result:=true;
|
sl.Add(ControlToStr(AControl));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
sl:=TStringListUTF8Fast.Create;
|
sl:=TStringListUTF8Fast.Create; // By default sl.Duplicates:=dupIgnore
|
||||||
sl.Add(AnchorDesignerNoSiblingText);
|
sl.Add(AnchorDesignerNoSiblingText);
|
||||||
HasSelectedSiblings:=false;
|
HasSelSiblings:=false;
|
||||||
SelectedControls:=GetSelectedControls;
|
SelectedControls:=GetSelectedControls;
|
||||||
if SelectedControls<>nil then begin
|
if SelectedControls<>nil then begin
|
||||||
for i:=0 to SelectedControls.Count-1 do begin
|
for i:=0 to SelectedControls.Count-1 do begin
|
||||||
@ -982,21 +979,18 @@ begin
|
|||||||
if (CurControl.Parent<>nil)
|
if (CurControl.Parent<>nil)
|
||||||
and not (csDesignInstance in CurControl.ComponentState)
|
and not (csDesignInstance in CurControl.ComponentState)
|
||||||
then begin
|
then begin
|
||||||
AddSibling(CurControl.Parent);
|
AddSiblingSkipSelected(CurControl.Parent);
|
||||||
for j:=0 to CurControl.Parent.ControlCount-1 do begin
|
for j:=0 to CurControl.Parent.ControlCount-1 do begin
|
||||||
Sibling:=CurControl.Parent.Controls[j];
|
Sibling:=CurControl.Parent.Controls[j];
|
||||||
if (Sibling<>CurControl) then begin
|
if (Sibling<>CurControl) and AddSiblingSkipSelected(Sibling) then
|
||||||
AddSibling(Sibling);
|
HasSelSiblings:=true;
|
||||||
if SelectedControls.IndexOf(Sibling)>=0 then
|
|
||||||
HasSelectedSiblings:=true;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if HasSelectedSiblings then
|
if HasSelSiblings then
|
||||||
for Kind:=akTop to akBottom do
|
for Kind:=akTop to akBottom do
|
||||||
sl.add(AnchorDesignerNeighbourText(Kind));
|
sl.add(AnchorDesignerNeighbourText(Kind));
|
||||||
OldText:=AComboBox.Text;
|
OldText:=AComboBox.Text;
|
||||||
|
Loading…
Reference in New Issue
Block a user