OnChildAdded||doc136703

September 20, 2022

Format

local event = Window:GetEvent("OnChildAdded")

Describe

The event is triggered when a child control is added to the target control.

Callback function parameters

Type name introduce
Window window current window
Window child Child controls added

Code example

local event = UI.Root:GetEvent("OnChildAdded")
event:Bind(function(window, child)
    print("UI Root add child!", child.name)
end)

-- Create a Image widget
local window = UI:CreateGUIWidget(Enum.WidgetType.Image, "childImage")
window.Parent = UI.Root