Anchoring

Anchoring

Anchoring allows you to setup a Parent/Child relationship for GUI widgets.

For example, we could create a ui_panel widget (Parent, lets call the instance “myInstPanel”) and then we create many controls on the panel like ui_buttons, ui_labels(children)…etc. On each of the child widgets (buttons, labels.. etc) we set uiAnchor=myIntPanel; When that happens we now can do actions on myInstPanel that will automatically happen on all it’s children. We could set myInstPanel.uiVisible=false, that would hide not only the panel, but all the child widgets that have myInstPanel as their anchor. This is a great way to handle groups on widgets like menus and such.

Here are some more properties that affect what the children will ‘inherit’ from their Parent(uiAnchror). You would set these on the child widgets.

uiAnchorPos=true; //if take the xpos/ypos changes of its parent…
uiVisibleChild=true; //if take the uiVisible property of its parent…
uiEnabledChild=true; //if take the uiEnabled property of its parent…

You may also like...