FindComponent

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36160
    alexhaifa
    Participant

    Hello,

    I am trying to use FindComponent with sLabel and I can't find it.

    What happened to findcomponent to not find all the components in my form?

    Please, take a look at my code

    TsLabelFX(FindComponent('lblTitulo_' + IntToStr(i))).Caption;

    With a simple label I can do that

    Thanks

    Alexandre

    #51975
    CheshireCat
    Participant

    Hello,

    you mean something like that?

    Code:

    procedure TForm1.sButton1Click(Sender: TObject);
    var
    i : integer;
    begin

    for i := 1 to 4 do
    if FindComponent('sLabelFX' + IntToStr(i)) is TsLabelFX then
    with FindComponent('sLabelFX' + IntToStr(i)) as TsLabelFX do
    Caption := 'My Label ' + IntToStr(i);

    end;

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.