Hola,
Bueno, yo también quiero.
Sobre todo para dejar claro que cuando antes hablaba de "Components" y "ComponentsCount", en realidad quería decir "Controls" y "ControlsCount". Por lo demás, el siguiente código intenta un objetivo muy parecido al que
Caral ha escrito arriba:
Código Delphi
[-]
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
errors: string;
const
MSG_SEPARATOR = #13#13;
EMPTY_EDIT_MSG = '%s edit is empty';
begin
errors := '';
for i := 0 to EditsPanel.ControlCount - 1 do
begin
if (EditsPanel.Controls[i] is TEdit) then
begin
if (Trim(TEdit(EditsPanel.Controls[i]).Text) = EmptyStr) then
begin
if (errors = EmptyStr) then begin
errors := Format(EMPTY_EDIT_MSG,
[TEdit(EditsPanel.Controls[i]).Name]);
end else begin
errors := errors + MSG_SEPARATOR + Format(
EMPTY_EDIT_MSG, [TEdit(EditsPanel.Controls[i]).Name]);
end;
end;
end;
end;
if (errors <> EmptyStr) then begin
ShowMessage(errors);
end else begin
ShowMessage('All edits contain values');
end;
end;