WoW:API Frame GetChildren: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
m (Move page script moved page API Frame GetChildren to API Frame GetChildren without leaving a redirect)
 
(7 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{API/Uncategorized}}
{{widgetmethod}} __NOTOC__
 
 
Gets the children of a frame.
child1, child2, ..., childN = Frame:GetChildren()
 
 
== Arguments ==
None
 
 
== Returns ==
:(child1, child2, ...)
:
:The array can be referenced as an '''ipairs''' object. See example.
:; child1
:: [[Frame]] - The first child of the frame
:; child2
:: [[Frame]] - The second child of the frame
:; ...
:; childN
:: [[Frame]] - The last child of the frame
 
== Example ==
local kids = { QuestLogFrame:GetChildren() };
for _, child in ipairs(kids) do
  -- stuff
end
 
== Print children names macro for Developers ==
 
-- Prints the names of all children of the frame your cursor is hovering
 
/run function kiddos () local kiddos = { GetMouseFocus():GetChildren() }; for _, child in ipairs(kiddos) do DEFAULT_CHAT_FRAME:AddMessage(child:GetName()); end end kiddos();
 
 
 
 
Standalone function:
function kiddos ()
    kiddos = { GetMouseFocus():GetChildren() };
    for _, child in ipairs(kiddos) do
        DEFAULT_CHAT_FRAME:AddMessage(child:GetName());
    end
end
 
 
Tested in the 1.12.1 Vanilla WoW game client.

Latest revision as of 04:45, 15 August 2023

Widget API ← Frame < GetChildren


Gets the children of a frame.

child1, child2, ..., childN = Frame:GetChildren()


Arguments[edit]

None


Returns[edit]

(child1, child2, ...)
The array can be referenced as an ipairs object. See example.
child1
Frame - The first child of the frame
child2
Frame - The second child of the frame
...
childN
Frame - The last child of the frame

Example[edit]

local kids = { QuestLogFrame:GetChildren() };

for _, child in ipairs(kids) do
  -- stuff
end

Print children names macro for Developers[edit]

-- Prints the names of all children of the frame your cursor is hovering

/run function kiddos () local kiddos = { GetMouseFocus():GetChildren() }; for _, child in ipairs(kiddos) do DEFAULT_CHAT_FRAME:AddMessage(child:GetName()); end end kiddos();



Standalone function:

function kiddos ()
    kiddos = { GetMouseFocus():GetChildren() };
    for _, child in ipairs(kiddos) do
        DEFAULT_CHAT_FRAME:AddMessage(child:GetName());
    end
end


Tested in the 1.12.1 Vanilla WoW game client.