In jQuery we can reference an element of the form below:
var tipo = "B";
$("#campoTipo"+tipo).val("Teste");
that would be the same as:
$("#campoTipoB").val("Teste");
I need in Delphi, disable some buttons that depend on a Query
procedure TFormCupom.BitBtn3Click(Sender: TObject);
var
ponteiro: Integer;
painel: TPanel;
begin
DM.FDConexao.Connected := true;
ponteiro := 0;
with DM.FDQ_Recentes do
begin
close;
sql.clear;
sql.add('SELECT * FROM rotativo');
open;
First; // primeiro
while not eof do
begin
inc(ponteiro);
painel := FindComponent('Pn' + IntToStr(ponteiro)) as TPanel;
if painel <> nil then
painel.Visible := false;
Next; // proximo
end;
end;
end;