From f0a9cde06022be6c05d402be967f3686a1d71f14 Mon Sep 17 00:00:00 2001
From: Juha <juha@lazarus-ide.org>
Date: Tue, 7 Jan 2025 18:18:04 +0200
Subject: [PATCH] Anchor Editor: Don't add (sub)controls with
 csNoDesignSelectable in ControlStyle. Issue #41314.

---
 designer/anchoreditor.pas | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/designer/anchoreditor.pas b/designer/anchoreditor.pas
index a555b0d3ae..03b91bb0fc 100644
--- a/designer/anchoreditor.pas
+++ b/designer/anchoreditor.pas
@@ -962,8 +962,7 @@ var
     if AControl.Name='' then exit;
     // Skip selected siblings and return True.
     if SelectedControls.IndexOf(AControl)>=0 then exit(true);
-    // This can happen with combined controls like TLabeledEdit.
-    if Assigned(AControl.Owner) and (AControl.Owner<>AControl.Parent) then exit;
+    if csNoDesignSelectable in AControl.ControlStyle then exit;
     sl.Add(ControlToStr(AControl));
   end;