Get the id of a Panel that is being created dynamically

Asked

Viewed 103 times

0

I am creating several panel dynamically according to the number of entries in a database table and data:

pnlBtn := TPanel.Create(Self); // Cria o um Panel
      pnlBtn.Parent := pnlMesas; // seta pnlMesa como parente

      sTop := FloatToStr(rTop);
      sLeft := FloatToStr(rLeft);

      //Posição do Panel
      pnlBtn.Top := StrToInt(sTop);
      pnlBtn.Left := StrToInt(sLeft);

      //Tamanho do Panel
      pnlBtn.Width := 103;
      pnlBtn.Height := 50;

      //Informações Gerais do panel
      pnlBtn.Name := 'pnlMesaComanda' + intToStr(iContador);

and wanted to create several label inside this dynamic panel with the information registered in the bank but how I get the id of this panel that I created dynamically to put in Parent?

example:

lblCod := TLabel.Create(Self);
lblCod.Parent := 'pnlMesaComanda' + intToStr(iContador);

someone can help me?

1 answer

2


In delhpi there is no question of id, but the name of the components serve with identifier. Then his Name will be the id, or you can create a variable within it with to be the id.

  • 1

    worked out, thank you very much

Browser other questions tagged

You are not signed in. Login or sign up in order to post.