Jump to content

ChildByName challenge

Recommended Posts

It is probably to my lack of understanding but I would like to find a solution to this problem.


If I create a label like this


ALabel := new Tw3Label(self); // = self being the form

ALabel.name :='lb'+inttostr(i+1);




if assigned(ChildByName('lbl'+inttostr(i))) then

tw3label(ChildByName('lbl'+inttostr(i))).Caption := QItem.FQuestion;


Works fine.


However, if I change the create to use a panel

ALabel := new Tw3Label(BackPanel);



Then it fails to find ChildByName. The BackPanel is a panel on the form


How do I solves this problem? Where is my logic going wrong?

Link to post
Share on other sites

Thanks Dennis that was the clue I was looking for. I expected it to work like findcomponentbyname I didn't realise you could add it to object




I couldn't find a single sample or examples in the RTL of ChildByName being used like this :)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...