Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Form controls and recursive coding
Sun, Jul 8 2018 8:05 AMPermanent Link

thomh

Hello,

Does anybody have a good recursive method for going through all controls on a form and setting their caption. I am especially thinking about cases where you have a panel within a panel within a panel, etc. and each with its own embedded controls.

Thanks.

// Thom
Sun, Jul 8 2018 10:52 AMPermanent Link

Matthew Jones

<thomh> wrote:
> Hello,
>
> Does anybody have a good recursive method for going through all controls
> on a form and setting their caption. I am especially thinking about cases
> where you have a panel within a panel within a panel, etc. and each with
> its own embedded controls.

Not hard to do your own. Just recurse on the too. And you can pass a
callback if that is a better option than coding in-situ.

I can dig something up later as an example.

--
Matthew Jones
Mon, Jul 9 2018 4:33 AMPermanent Link

Matthew Jones


procedure UpdatePanelTags(xPanel : TBasicPanel);
var
   nTag : Integer;
   i: integer;
   c: TComponent;
begin
   nTag := xPanel.Tag;
   for i := xPanel.componentcount - 1 downto 0 do
   begin
       c := xPanel.component[i];
       c.Tag := nTag;
       if c is TBasicPanel then
           UpdatePanelTags(TBasicPanel(c));
   end;
end;

Expand as appropriate...

--

Matthew Jones
Image