Einzelnen Beitrag anzeigen

Pfaffe

Registriert seit: 29. Jan 2009
297 Beiträge
 
Delphi 12 Athens
 
#7

AW: Mehrere Editfelder gleichzeitig initialisieren

  Alt 28. Feb 2019, 13:45
Beispiel für beliebig viele Controls, z.B. TEdits, die auf einem Panel liegen:
Delphi-Quellcode:
for i:= 0 to Panel_Filter.ControlCount-1 do begin
  if Panel_Filter.Controls[i] is TLabel then
    (Panel_Filter.Controls[i] as TLabel).Font.Style:= []
  else if Panel_Filter.Controls[i] is TEdit then
    (Panel_Filter.Controls[i] as TEdit).Text:= ''
  else if Panel_Filter.Controls[i] is TMaskEdit then
    (Panel_Filter.Controls[i] as TMaskEdit).Text:= ''
  else if Panel_Filter.Controls[i] is TCheckBox then
    (Panel_Filter.Controls[i] as TCheckBox).Checked:= false
  else if Panel_Filter.Controls[i] is TComboBox then
    (Panel_Filter.Controls[i] as TComboBox).ItemIndex:= 0;
end;
  Mit Zitat antworten Zitat