![]() |
Auf alle Controls eines Panels zugreifen
Hallo Leute !
ich möchte in einer Schleife auf alle Contols auf einem Panel zugreifen, um eine Eigenschaft der Conrols (z.B. Color) zu ändern. kann mir jemand einen Tip dazu geben. vielen Dank im Voraus. Sam |
Re: Auf alle Controls eines Panels zugreifen
Hi,
folgendes Beispiel switcht den Enabled State der Controls auf Wunsch auch recursiv:
Delphi-Quellcode:
Cu, Frank
procedure TForm1.Button1Click(Sender: TObject);
begin ChangeEnabled(Panel1, True); end; procedure TForm1.ChangeEnabled(AControl: TWinControl; Recursiv: Boolean = True); Var i : Integer; begin for i := 0 to Pred(AControl.ControlCount) do begin AControl.Controls[i].Enabled := not AControl.Controls[i].Enabled; if Recursiv and (AControl.Controls[i] is TWinControl) and (TWinControl(AControl.Controls[i]).ControlCount > 0) then ChangeEnabled(TWinControl(AControl.Controls[i]), Recursiv); end; end; |
Re: Auf alle Controls eines Panels zugreifen
Hallo dataspider
Super ! Sehr elegante Lösung. Funktioniert bei mir einwandfrei. Vielen Dank! Sam |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:05 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz