CrabUI
|
public CUIComponent Append(CUIComponent child, string name = null) public CUIComponent Prepend(CUIComponent child, string name = null) public CUIComponent Insert(CUIComponent child, int index, string name = null) ComponentA["some name"] = ComponentB ComponentA.AddChildren = List<CUIComponent>
You can also set parent directly
ComponentB.Parent = ComponentA
But then you'll also need to manually add child to the parent children list
You can remove a child with
ComponentA.RemoveChild(ComponentB)
or by calling
ComponentB.RemoveSelf()
Or you can remove all children with
ComponentA.RemoveAllChildren()
Every component has a dictionary of NamedComponents
You can access it like this:
ComponentA["some name"]
this
ComponentA["some name"] = ComponentB
is the same as this
ComponentA.Append(ComponentB) ComponentA.Remember(ComponentB, "some name")
if a child already has a parent it won't be added to the children list by "ComponentA["some name"]", it'll just be remembered
Also you can use Get(string name) method, it's like ComponentA["some name"] but it can give you nested component, and Get< T > version can also cast it for you
Header = Frame.Get<CUIHorizontalList>("layout.content.header");