Forum Discussion

WSJTim's avatar
WSJTim
Binge Watcher
5 years ago
Solved

Initializing children of a custom component

I'm writing a custom component that extends LayoutGroup and I'd like to set up event observers on children. When my init() sub gets called, m.top has no children yet so I can't access any yet. In later methods (like "onKeyEvent") I can see the children there but obviously I don't want to set everything up multiple times.

Any help would be appreciated!

tim

  • WSJTim's avatar
    WSJTim
    Binge Watcher

    Ok, this might not have been clear. These are children not specified by my component directly. Once again, similar to a LayoutGroup. For example:

    <MyComponent>
        <Button .../>
        <Label .../>
        <Button .../>
    </MyComponent>